;
(function () {
    function _slicedToArray(r, e) {
        return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
    }

    function _nonIterableRest() {
        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _iterableToArrayLimit(r, l) {
        var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
        if (null != t) {
            var e, n, i, u, a = [], f = !0, o = !1;
            try {
                if (i = (t = t.call(r)).next, 0 === l) {
                    if (Object(t) !== t) return;
                    f = !1;
                } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
            } catch (r) {
                o = !0, n = r;
            } finally {
                try {
                    if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
                } finally {
                    if (o) throw n;
                }
            }
            return a;
        }
    }

    function _arrayWithHoles(r) {
        if (Array.isArray(r)) return r;
    }

    function _callSuper(t, o, e) {
        return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
    }

    function _possibleConstructorReturn(t, e) {
        if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
        if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
        return _assertThisInitialized(t);
    }

    function _assertThisInitialized(e) {
        if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return e;
    }

    function _isNativeReflectConstruct() {
        try {
            var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {
            }));
        } catch (t) {
        }
        return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
            return !!t;
        })();
    }

    function _getPrototypeOf(t) {
        return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
            return t.__proto__ || Object.getPrototypeOf(t);
        }, _getPrototypeOf(t);
    }

    function _inherits(t, e) {
        if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
        t.prototype = Object.create(e && e.prototype, {
            constructor: {
                value: t,
                writable: !0,
                configurable: !0
            }
        }), Object.defineProperty(t, "prototype", {writable: !1}), e && _setPrototypeOf(t, e);
    }

    function _setPrototypeOf(t, e) {
        return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
            return t.__proto__ = e, t;
        }, _setPrototypeOf(t, e);
    }

    function _toConsumableArray(r) {
        return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
    }

    function _nonIterableSpread() {
        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _unsupportedIterableToArray(r, a) {
        if (r) {
            if ("string" == typeof r) return _arrayLikeToArray(r, a);
            var t = {}.toString.call(r).slice(8, -1);
            return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
        }
    }

    function _iterableToArray(r) {
        if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
    }

    function _arrayWithoutHoles(r) {
        if (Array.isArray(r)) return _arrayLikeToArray(r);
    }

    function _arrayLikeToArray(r, a) {
        (null == a || a > r.length) && (a = r.length);
        for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
        return n;
    }

    function ownKeys(e, r) {
        var t = Object.keys(e);
        if (Object.getOwnPropertySymbols) {
            var o = Object.getOwnPropertySymbols(e);
            r && (o = o.filter(function (r) {
                return Object.getOwnPropertyDescriptor(e, r).enumerable;
            })), t.push.apply(t, o);
        }
        return t;
    }

    function _objectSpread(e) {
        for (var r = 1; r < arguments.length; r++) {
            var t = null != arguments[r] ? arguments[r] : {};
            r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
                _defineProperty(e, r, t[r]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
                Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
            });
        }
        return e;
    }

    function _defineProperty(e, r, t) {
        return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
            value: t,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[r] = t, e;
    }

    function _classCallCheck(a, n) {
        if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
    }

    function _defineProperties(e, r) {
        for (var t = 0; t < r.length; t++) {
            var o = r[t];
            o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
        }
    }

    function _createClass(e, r, t) {
        return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {writable: !1}), e;
    }

    function _toPropertyKey(t) {
        var i = _toPrimitive(t, "string");
        return "symbol" == _typeof(i) ? i : i + "";
    }

    function _toPrimitive(t, r) {
        if ("object" != _typeof(t) || !t) return t;
        var e = t[Symbol.toPrimitive];
        if (void 0 !== e) {
            var i = e.call(t, r || "default");
            if ("object" != _typeof(i)) return i;
            throw new TypeError("@@toPrimitive must return a primitive value.");
        }
        return ("string" === r ? String : Number)(t);
    }

    function _typeof(o) {
        "@babel/helpers - typeof";
        return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
            return typeof o;
        } : function (o) {
            return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
        }, _typeof(o);
    }

    System.register(['./SimpleDialog.vue_vue_type_script_setup_true_lang-legacy-8tjYmIZV.js', './index-legacy-BBSVeb5I.js', './SimpleDrawer.vue_vue_type_script_setup_true_lang-legacy-hDhCqA-5.js', './IconButton.vue_vue_type_script_setup_true_lang-legacy-jwPT8TzR.js', './SimpleCollapse.vue_vue_type_script_setup_true_lang-legacy-WngZx8ev.js', './SelectGroup.vue_vue_type_script_setup_true_lang-legacy-DczqbOUF.js', './model-legacy-BU3w3-Vj.js', './app-legacy-wYNNcMjG.js', './model-form.vue_vue_type_script_setup_true_lang-legacy-Dxg0XZGP.js', './useCopy-legacy-BVMLXgLP.js', './dateUtils-legacy-0RWazmFe.js', './SimpleInput.vue_vue_type_script_setup_true_lang-legacy-CRUKVKwE.js', './executor-legacy-BMXoEXle.js', './vue-codemirror.esm-legacy-kFkrhprE.js'], function (exports, module) {
        'use strict';

        var _sfc_main$h, defineComponent, useModel, createElementBlock, createBaseVNode, normalizeClass,
            createTextVNode, openBlock, _export_sfc, mergeModels, computed, createBlock, withCtx, toDisplayString,
            unref, Fragment, createVNode, createCommentVNode, createReusableTemplate, ref, resolveComponent, isRef,
            normalizeStyle, renderList, useCssVars, renderSlot, onMounted, _sfc_main$c, api, storeToRefs, modelFilters,
            watchDebounced, withDirectives, vModelText, useRouter, _sfc_main$6, _sfc_main$f, _sfc_main$8, _sfc_main$9,
            _sfc_main$e, _sfc_main$d, getModelPeggings, createModelPeggingMap, getModelList, getAllTags, deleteModel,
            useAppStore, _sfc_main$g, useCopy, _sfc_main$7, formatToDateTime, getHashColorFromString, _sfc_main$b,
            _sfc_main$a;
        return {
            setters: [function (module) {
                _sfc_main$h = module._;
            }, function (module) {
                defineComponent = module.d;
                useModel = module.m;
                createElementBlock = module.a;
                createBaseVNode = module.b;
                normalizeClass = module.n;
                createTextVNode = module.v;
                openBlock = module.o;
                _export_sfc = module._;
                mergeModels = module.J;
                computed = module.f;
                createBlock = module.c;
                withCtx = module.p;
                toDisplayString = module.t;
                unref = module.u;
                Fragment = module.F;
                createVNode = module.q;
                createCommentVNode = module.k;
                createReusableTemplate = module.a1;
                ref = module.e;
                resolveComponent = module.r;
                isRef = module.y;
                normalizeStyle = module.H;
                renderList = module.j;
                useCssVars = module.a2;
                renderSlot = module.I;
                onMounted = module.K;
                _sfc_main$c = module.s;
                api = module.G;
                storeToRefs = module.z;
                modelFilters = module.a3;
                watchDebounced = module.a4;
                withDirectives = module.L;
                vModelText = module.P;
                useRouter = module.g;
            }, function (module) {
                _sfc_main$6 = module._;
            }, function (module) {
                _sfc_main$f = module._;
            }, function (module) {
                _sfc_main$8 = module._;
                _sfc_main$9 = module.a;
                _sfc_main$e = module.b;
            }, function (module) {
                _sfc_main$d = module._;
            }, function (module) {
                getModelPeggings = module.a;
                createModelPeggingMap = module.c;
                getModelList = module.g;
                getAllTags = module.b;
                deleteModel = module.d;
            }, function (module) {
                useAppStore = module.u;
            }, function (module) {
                _sfc_main$g = module._;
            }, function (module) {
                useCopy = module.u;
                _sfc_main$7 = module._;
            }, function (module) {
                formatToDateTime = module.f;
                getHashColorFromString = module.g;
            }, function (module) {
                _sfc_main$b = module._;
            }, function (module) {
                _sfc_main$a = module._;
            }, null],
            execute: function execute() {
                var __vite_style__ = document.createElement('style');
                __vite_style__.textContent = "\n.view-item[data-v-d310ea60] {\ndisplay:flex;align-items:center;gap:0.25rem;border-style:none;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;opacity:0.75;\n}.view-item[data-v-d310ea60]:hover{--un-bg-opacity:1;background-color:rgb(246 246 246 / var(--un-bg-opacity)) /* #f6f6f6 */;opacity:1;}\n.view-item-active[data-v-d310ea60] {\nbackground-color:rgb(156 163 175 / 0.15) /* #9ca3af */ !important;--un-text-opacity:1;color:rgb(0 101 255 / var(--un-text-opacity)) /* #0065ff */;opacity:1 !important;\n}\r\n\n.group[data-v-ba445398]:hover {\r\n  background: var(--1c368f7c) !important;\n}\n.group:hover .model-name[data-v-ba445398] {\r\n  color: var(--304a35a4) !important;\n}\r\n\n.bar[data-v-f49db258]::before {\r\n  position: absolute;\r\n  top: 50%;\r\n  left: 0;\r\n  transform: translateY(-50%);\r\n  width: 4px;\r\n  height: 1rem;\n--un-bg-opacity:1;background-color:rgb(0 101 255 / var(--un-bg-opacity)) /* #0065ff */;\r\n  content: '';\n}\r\n/*$vite$:1*/";
                document.head.appendChild(__vite_style__);
                var _hoisted_1$4 = {
                    border: "~ base rounded",
                    flex: "~ inline"
                };
                var _sfc_main$5 = /* @__PURE__ */defineComponent({
                    __name: "ViewType",
                    props: {
                        "modelValue": {
                            default: "list"
                        },
                        "modelModifiers": {}
                    },
                    emits: ["update:modelValue"],
                    setup: function setup(__props) {
                        var modelValue = useModel(__props, "modelValue");
                        return function (_ctx, _cache) {
                            return openBlock(), createElementBlock("div", _hoisted_1$4, [createBaseVNode("button", {
                                class: normalizeClass([modelValue.value === "grid" ? "view-item-active" : "", "view-item"]),
                                onClick: _cache[0] || (_cache[0] = function ($event) {
                                    return modelValue.value = "grid";
                                })
                            }, _cache[2] || (_cache[2] = [createBaseVNode("div", {
                                class: "i-ph:grid-four"
                            }, null, -1), createTextVNode("卡片 ")]), 2), _cache[4] || (_cache[4] = createBaseVNode("div", {
                                border: "l base"
                            }, null, -1)), createBaseVNode("button", {
                                class: normalizeClass([modelValue.value === "list" ? "view-item-active" : "", "view-item"]),
                                onClick: _cache[1] || (_cache[1] = function ($event) {
                                    return modelValue.value = "list";
                                })
                            }, _cache[3] || (_cache[3] = [createBaseVNode("div", {
                                class: "i-ph:list"
                            }, null, -1), createTextVNode("列表 ")]), 2)]);
                        };
                    }
                });

                /* unplugin-vue-components disabled */

                var __unplugin_components_1 = /* @__PURE__ */_export_sfc(_sfc_main$5, [["__scopeId", "data-v-d310ea60"]]);

                /**
                 * Fuse.js v7.1.0 - Lightweight fuzzy-search (http://fusejs.io)
                 *
                 * Copyright (c) 2025 Kiro Risk (http://kiro.me)
                 * All Rights Reserved. Apache Software License 2.0
                 *
                 * http://www.apache.org/licenses/LICENSE-2.0
                 */

                function isArray(value) {
                    return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value);
                }

                function baseToString(value) {
                    // Exit early for strings to avoid a performance hit in some environments.
                    if (typeof value == 'string') {
                        return value;
                    }
                    var result = value + '';
                    return result == '0' && 1 / value == -Infinity ? '-0' : result;
                }

                function toString(value) {
                    return value == null ? '' : baseToString(value);
                }

                function isString(value) {
                    return typeof value === 'string';
                }

                function isNumber(value) {
                    return typeof value === 'number';
                }

                // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js
                function isBoolean(value) {
                    return value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]';
                }

                function isObject(value) {
                    return _typeof(value) === 'object';
                }

                // Checks if `value` is object-like.
                function isObjectLike(value) {
                    return isObject(value) && value !== null;
                }

                function isDefined(value) {
                    return value !== undefined && value !== null;
                }

                function isBlank(value) {
                    return !value.trim().length;
                }

                // Gets the `toStringTag` of `value`.
                // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js
                function getTag(value) {
                    return value == null ? value === undefined ? '[object Undefined]' : '[object Null]' : Object.prototype.toString.call(value);
                }

                var INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
                var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = function LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key) {
                    return "Invalid value for key ".concat(key);
                };
                var PATTERN_LENGTH_TOO_LARGE = function PATTERN_LENGTH_TOO_LARGE(max) {
                    return "Pattern length exceeds max of ".concat(max, ".");
                };
                var MISSING_KEY_PROPERTY = function MISSING_KEY_PROPERTY(name) {
                    return "Missing ".concat(name, " property in key");
                };
                var INVALID_KEY_WEIGHT_VALUE = function INVALID_KEY_WEIGHT_VALUE(key) {
                    return "Property 'weight' in key '".concat(key, "' must be a positive integer");
                };
                var hasOwn = Object.prototype.hasOwnProperty;
                var KeyStore = /*#__PURE__*/function () {
                    function KeyStore(keys) {
                        var _this = this;
                        _classCallCheck(this, KeyStore);
                        this._keys = [];
                        this._keyMap = {};
                        var totalWeight = 0;
                        keys.forEach(function (key) {
                            var obj = createKey(key);
                            _this._keys.push(obj);
                            _this._keyMap[obj.id] = obj;
                            totalWeight += obj.weight;
                        });

                        // Normalize weights so that their sum is equal to 1
                        this._keys.forEach(function (key) {
                            key.weight /= totalWeight;
                        });
                    }

                    return _createClass(KeyStore, [{
                        key: "get",
                        value: function get(keyId) {
                            return this._keyMap[keyId];
                        }
                    }, {
                        key: "keys",
                        value: function keys() {
                            return this._keys;
                        }
                    }, {
                        key: "toJSON",
                        value: function toJSON() {
                            return JSON.stringify(this._keys);
                        }
                    }]);
                }();

                function createKey(key) {
                    var path = null;
                    var id = null;
                    var src = null;
                    var weight = 1;
                    var getFn = null;
                    if (isString(key) || isArray(key)) {
                        src = key;
                        path = createKeyPath(key);
                        id = createKeyId(key);
                    } else {
                        if (!hasOwn.call(key, 'name')) {
                            throw new Error(MISSING_KEY_PROPERTY('name'));
                        }
                        var name = key.name;
                        src = name;
                        if (hasOwn.call(key, 'weight')) {
                            weight = key.weight;
                            if (weight <= 0) {
                                throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
                            }
                        }
                        path = createKeyPath(name);
                        id = createKeyId(name);
                        getFn = key.getFn;
                    }
                    return {
                        path: path,
                        id: id,
                        weight: weight,
                        src: src,
                        getFn: getFn
                    };
                }

                function createKeyPath(key) {
                    return isArray(key) ? key : key.split('.');
                }

                function createKeyId(key) {
                    return isArray(key) ? key.join('.') : key;
                }

                function get(obj, path) {
                    var list = [];
                    var arr = false;
                    var _deepGet = function deepGet(obj, path, index) {
                        if (!isDefined(obj)) {
                            return;
                        }
                        if (!path[index]) {
                            // If there's no path left, we've arrived at the object we care about.
                            list.push(obj);
                        } else {
                            var key = path[index];
                            var value = obj[key];
                            if (!isDefined(value)) {
                                return;
                            }

                            // If we're at the last value in the path, and if it's a string/number/bool,
                            // add it to the list
                            if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {
                                list.push(toString(value));
                            } else if (isArray(value)) {
                                arr = true;
                                // Search each item in the array.
                                for (var i = 0, len = value.length; i < len; i += 1) {
                                    _deepGet(value[i], path, index + 1);
                                }
                            } else if (path.length) {
                                // An object. Recurse further.
                                _deepGet(value, path, index + 1);
                            }
                        }
                    };

                    // Backwards compatibility (since path used to be a string)
                    _deepGet(obj, isString(path) ? path.split('.') : path, 0);
                    return arr ? list : list[0];
                }

                var MatchOptions = {
                    // Whether the matches should be included in the result set. When `true`, each record in the result
                    // set will include the indices of the matched characters.
                    // These can consequently be used for highlighting purposes.
                    includeMatches: false,
                    // When `true`, the matching function will continue to the end of a search pattern even if
                    // a perfect match has already been located in the string.
                    findAllMatches: false,
                    // Minimum number of characters that must be matched before a result is considered a match
                    minMatchCharLength: 1
                };
                var BasicOptions = {
                    // When `true`, the algorithm continues searching to the end of the input even if a perfect
                    // match is found before the end of the same input.
                    isCaseSensitive: false,
                    // When `true`, the algorithm will ignore diacritics (accents) in comparisons
                    ignoreDiacritics: false,
                    // When true, the matching function will continue to the end of a search pattern even if
                    includeScore: false,
                    // List of properties that will be searched. This also supports nested properties.
                    keys: [],
                    // Whether to sort the result list, by score
                    shouldSort: true,
                    // Default sort function: sort by ascending score, ascending index
                    sortFn: function sortFn(a, b) {
                        return a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1;
                    }
                };
                var FuzzyOptions = {
                    // Approximately where in the text is the pattern expected to be found?
                    location: 0,
                    // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
                    // (of both letters and location), a threshold of '1.0' would match anything.
                    threshold: 0.6,
                    // Determines how close the match must be to the fuzzy location (specified above).
                    // An exact letter match which is 'distance' characters away from the fuzzy location
                    // would score as a complete mismatch. A distance of '0' requires the match be at
                    // the exact location specified, a threshold of '1000' would require a perfect match
                    // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
                    distance: 100
                };
                var AdvancedOptions = {
                    // When `true`, it enables the use of unix-like search commands
                    useExtendedSearch: false,
                    // The get function to use when fetching an object's properties.
                    // The default will search nested paths *ie foo.bar.baz*
                    getFn: get,
                    // When `true`, search will ignore `location` and `distance`, so it won't matter
                    // where in the string the pattern appears.
                    // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
                    ignoreLocation: false,
                    // When `true`, the calculation for the relevance score (used for sorting) will
                    // ignore the field-length norm.
                    // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
                    ignoreFieldNorm: false,
                    // The weight to determine how much field length norm effects scoring.
                    fieldNormWeight: 1
                };
                var Config = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, BasicOptions), MatchOptions), FuzzyOptions), AdvancedOptions);
                var SPACE = /[^ ]+/g;

                // Field-length norm: the shorter the field, the higher the weight.
                // Set to 3 decimals to reduce index size.
                function norm() {
                    var weight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
                    var mantissa = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
                    var cache = new Map();
                    var m = Math.pow(10, mantissa);
                    return {
                        get: function get(value) {
                            var numTokens = value.match(SPACE).length;
                            if (cache.has(numTokens)) {
                                return cache.get(numTokens);
                            }

                            // Default function is 1/sqrt(x), weight makes that variable
                            var norm = 1 / Math.pow(numTokens, 0.5 * weight);

                            // In place of `toFixed(mantissa)`, for faster computation
                            var n = parseFloat(Math.round(norm * m) / m);
                            cache.set(numTokens, n);
                            return n;
                        },
                        clear: function clear() {
                            cache.clear();
                        }
                    };
                }

                var FuseIndex = /*#__PURE__*/function () {
                    function FuseIndex() {
                        var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
                            _ref$getFn = _ref.getFn,
                            getFn = _ref$getFn === void 0 ? Config.getFn : _ref$getFn,
                            _ref$fieldNormWeight = _ref.fieldNormWeight,
                            fieldNormWeight = _ref$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref$fieldNormWeight;
                        _classCallCheck(this, FuseIndex);
                        this.norm = norm(fieldNormWeight, 3);
                        this.getFn = getFn;
                        this.isCreated = false;
                        this.setIndexRecords();
                    }

                    return _createClass(FuseIndex, [{
                        key: "setSources",
                        value: function setSources() {
                            var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
                            this.docs = docs;
                        }
                    }, {
                        key: "setIndexRecords",
                        value: function setIndexRecords() {
                            var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
                            this.records = records;
                        }
                    }, {
                        key: "setKeys",
                        value: function setKeys() {
                            var _this2 = this;
                            var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
                            this.keys = keys;
                            this._keysMap = {};
                            keys.forEach(function (key, idx) {
                                _this2._keysMap[key.id] = idx;
                            });
                        }
                    }, {
                        key: "create",
                        value: function create() {
                            var _this3 = this;
                            if (this.isCreated || !this.docs.length) {
                                return;
                            }
                            this.isCreated = true;

                            // List is Array<String>
                            if (isString(this.docs[0])) {
                                this.docs.forEach(function (doc, docIndex) {
                                    _this3._addString(doc, docIndex);
                                });
                            } else {
                                // List is Array<Object>
                                this.docs.forEach(function (doc, docIndex) {
                                    _this3._addObject(doc, docIndex);
                                });
                            }
                            this.norm.clear();
                        }
                        // Adds a doc to the end of the index
                    }, {
                        key: "add",
                        value: function add(doc) {
                            var idx = this.size();
                            if (isString(doc)) {
                                this._addString(doc, idx);
                            } else {
                                this._addObject(doc, idx);
                            }
                        }
                        // Removes the doc at the specified index of the index
                    }, {
                        key: "removeAt",
                        value: function removeAt(idx) {
                            this.records.splice(idx, 1);

                            // Change ref index of every subsquent doc
                            for (var i = idx, len = this.size(); i < len; i += 1) {
                                this.records[i].i -= 1;
                            }
                        }
                    }, {
                        key: "getValueForItemAtKeyId",
                        value: function getValueForItemAtKeyId(item, keyId) {
                            return item[this._keysMap[keyId]];
                        }
                    }, {
                        key: "size",
                        value: function size() {
                            return this.records.length;
                        }
                    }, {
                        key: "_addString",
                        value: function _addString(doc, docIndex) {
                            if (!isDefined(doc) || isBlank(doc)) {
                                return;
                            }
                            var record = {
                                v: doc,
                                i: docIndex,
                                n: this.norm.get(doc)
                            };
                            this.records.push(record);
                        }
                    }, {
                        key: "_addObject",
                        value: function _addObject(doc, docIndex) {
                            var _this4 = this;
                            var record = {
                                i: docIndex,
                                $: {}
                            };

                            // Iterate over every key (i.e, path), and fetch the value at that key
                            this.keys.forEach(function (key, keyIndex) {
                                var value = key.getFn ? key.getFn(doc) : _this4.getFn(doc, key.path);
                                if (!isDefined(value)) {
                                    return;
                                }
                                if (isArray(value)) {
                                    var subRecords = [];
                                    var stack = [{
                                        nestedArrIndex: -1,
                                        value: value
                                    }];
                                    while (stack.length) {
                                        var _stack$pop = stack.pop(),
                                            nestedArrIndex = _stack$pop.nestedArrIndex,
                                            _value = _stack$pop.value;
                                        if (!isDefined(_value)) {
                                            continue;
                                        }
                                        if (isString(_value) && !isBlank(_value)) {
                                            var subRecord = {
                                                v: _value,
                                                i: nestedArrIndex,
                                                n: _this4.norm.get(_value)
                                            };
                                            subRecords.push(subRecord);
                                        } else if (isArray(_value)) {
                                            _value.forEach(function (item, k) {
                                                stack.push({
                                                    nestedArrIndex: k,
                                                    value: item
                                                });
                                            });
                                        } else ;
                                    }
                                    record.$[keyIndex] = subRecords;
                                } else if (isString(value) && !isBlank(value)) {
                                    var _subRecord = {
                                        v: value,
                                        n: _this4.norm.get(value)
                                    };
                                    record.$[keyIndex] = _subRecord;
                                }
                            });
                            this.records.push(record);
                        }
                    }, {
                        key: "toJSON",
                        value: function toJSON() {
                            return {
                                keys: this.keys,
                                records: this.records
                            };
                        }
                    }]);
                }();

                function createIndex(keys, docs) {
                    var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
                        _ref2$getFn = _ref2.getFn,
                        getFn = _ref2$getFn === void 0 ? Config.getFn : _ref2$getFn,
                        _ref2$fieldNormWeight = _ref2.fieldNormWeight,
                        fieldNormWeight = _ref2$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref2$fieldNormWeight;
                    var myIndex = new FuseIndex({
                        getFn: getFn,
                        fieldNormWeight: fieldNormWeight
                    });
                    myIndex.setKeys(keys.map(createKey));
                    myIndex.setSources(docs);
                    myIndex.create();
                    return myIndex;
                }

                function parseIndex(data) {
                    var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                        _ref3$getFn = _ref3.getFn,
                        getFn = _ref3$getFn === void 0 ? Config.getFn : _ref3$getFn,
                        _ref3$fieldNormWeight = _ref3.fieldNormWeight,
                        fieldNormWeight = _ref3$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref3$fieldNormWeight;
                    var keys = data.keys,
                        records = data.records;
                    var myIndex = new FuseIndex({
                        getFn: getFn,
                        fieldNormWeight: fieldNormWeight
                    });
                    myIndex.setKeys(keys);
                    myIndex.setIndexRecords(records);
                    return myIndex;
                }

                function computeScore$1(pattern) {
                    var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                        _ref4$errors = _ref4.errors,
                        errors = _ref4$errors === void 0 ? 0 : _ref4$errors,
                        _ref4$currentLocation = _ref4.currentLocation,
                        currentLocation = _ref4$currentLocation === void 0 ? 0 : _ref4$currentLocation,
                        _ref4$expectedLocatio = _ref4.expectedLocation,
                        expectedLocation = _ref4$expectedLocatio === void 0 ? 0 : _ref4$expectedLocatio,
                        _ref4$distance = _ref4.distance,
                        distance = _ref4$distance === void 0 ? Config.distance : _ref4$distance,
                        _ref4$ignoreLocation = _ref4.ignoreLocation,
                        ignoreLocation = _ref4$ignoreLocation === void 0 ? Config.ignoreLocation : _ref4$ignoreLocation;
                    var accuracy = errors / pattern.length;
                    if (ignoreLocation) {
                        return accuracy;
                    }
                    var proximity = Math.abs(expectedLocation - currentLocation);
                    if (!distance) {
                        // Dodge divide by zero error.
                        return proximity ? 1.0 : accuracy;
                    }
                    return accuracy + proximity / distance;
                }

                function convertMaskToIndices() {
                    var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
                    var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Config.minMatchCharLength;
                    var indices = [];
                    var start = -1;
                    var end = -1;
                    var i = 0;
                    for (var len = matchmask.length; i < len; i += 1) {
                        var match = matchmask[i];
                        if (match && start === -1) {
                            start = i;
                        } else if (!match && start !== -1) {
                            end = i - 1;
                            if (end - start + 1 >= minMatchCharLength) {
                                indices.push([start, end]);
                            }
                            start = -1;
                        }
                    }

                    // (i-1 - start) + 1 => i - start
                    if (matchmask[i - 1] && i - start >= minMatchCharLength) {
                        indices.push([start, i - 1]);
                    }
                    return indices;
                }

                // Machine word size
                var MAX_BITS = 32;

                function search(text, pattern, patternAlphabet) {
                    var _ref5 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
                        _ref5$location = _ref5.location,
                        location = _ref5$location === void 0 ? Config.location : _ref5$location,
                        _ref5$distance = _ref5.distance,
                        distance = _ref5$distance === void 0 ? Config.distance : _ref5$distance,
                        _ref5$threshold = _ref5.threshold,
                        threshold = _ref5$threshold === void 0 ? Config.threshold : _ref5$threshold,
                        _ref5$findAllMatches = _ref5.findAllMatches,
                        findAllMatches = _ref5$findAllMatches === void 0 ? Config.findAllMatches : _ref5$findAllMatches,
                        _ref5$minMatchCharLen = _ref5.minMatchCharLength,
                        minMatchCharLength = _ref5$minMatchCharLen === void 0 ? Config.minMatchCharLength : _ref5$minMatchCharLen,
                        _ref5$includeMatches = _ref5.includeMatches,
                        includeMatches = _ref5$includeMatches === void 0 ? Config.includeMatches : _ref5$includeMatches,
                        _ref5$ignoreLocation = _ref5.ignoreLocation,
                        ignoreLocation = _ref5$ignoreLocation === void 0 ? Config.ignoreLocation : _ref5$ignoreLocation;
                    if (pattern.length > MAX_BITS) {
                        throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
                    }
                    var patternLen = pattern.length;
                    // Set starting location at beginning text and initialize the alphabet.
                    var textLen = text.length;
                    // Handle the case when location > text.length
                    var expectedLocation = Math.max(0, Math.min(location, textLen));
                    // Highest score beyond which we give up.
                    var currentThreshold = threshold;
                    // Is there a nearby exact match? (speedup)
                    var bestLocation = expectedLocation;

                    // Performance: only computer matches when the minMatchCharLength > 1
                    // OR if `includeMatches` is true.
                    var computeMatches = minMatchCharLength > 1 || includeMatches;
                    // A mask of the matches, used for building the indices
                    var matchMask = computeMatches ? Array(textLen) : [];
                    var index;

                    // Get all exact matches, here for speed up
                    while ((index = text.indexOf(pattern, bestLocation)) > -1) {
                        var score = computeScore$1(pattern, {
                            currentLocation: index,
                            expectedLocation: expectedLocation,
                            distance: distance,
                            ignoreLocation: ignoreLocation
                        });
                        currentThreshold = Math.min(score, currentThreshold);
                        bestLocation = index + patternLen;
                        if (computeMatches) {
                            var i = 0;
                            while (i < patternLen) {
                                matchMask[index + i] = 1;
                                i += 1;
                            }
                        }
                    }

                    // Reset the best location
                    bestLocation = -1;
                    var lastBitArr = [];
                    var finalScore = 1;
                    var binMax = patternLen + textLen;
                    var mask = 1 << patternLen - 1;
                    for (var _i = 0; _i < patternLen; _i += 1) {
                        // Scan for the best match; each iteration allows for one more error.
                        // Run a binary search to determine how far from the match location we can stray
                        // at this error level.
                        var binMin = 0;
                        var binMid = binMax;
                        while (binMin < binMid) {
                            var _score = computeScore$1(pattern, {
                                errors: _i,
                                currentLocation: expectedLocation + binMid,
                                expectedLocation: expectedLocation,
                                distance: distance,
                                ignoreLocation: ignoreLocation
                            });
                            if (_score <= currentThreshold) {
                                binMin = binMid;
                            } else {
                                binMax = binMid;
                            }
                            binMid = Math.floor((binMax - binMin) / 2 + binMin);
                        }

                        // Use the result from this iteration as the maximum for the next.
                        binMax = binMid;
                        var start = Math.max(1, expectedLocation - binMid + 1);
                        var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;

                        // Initialize the bit array
                        var bitArr = Array(finish + 2);
                        bitArr[finish + 1] = (1 << _i) - 1;
                        for (var j = finish; j >= start; j -= 1) {
                            var currentLocation = j - 1;
                            var charMatch = patternAlphabet[text.charAt(currentLocation)];
                            if (computeMatches) {
                                // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)
                                matchMask[currentLocation] = +!!charMatch;
                            }

                            // First pass: exact match
                            bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;

                            // Subsequent passes: fuzzy match
                            if (_i) {
                                bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
                            }
                            if (bitArr[j] & mask) {
                                finalScore = computeScore$1(pattern, {
                                    errors: _i,
                                    currentLocation: currentLocation,
                                    expectedLocation: expectedLocation,
                                    distance: distance,
                                    ignoreLocation: ignoreLocation
                                });

                                // This match will almost certainly be better than any existing match.
                                // But check anyway.
                                if (finalScore <= currentThreshold) {
                                    // Indeed it is
                                    currentThreshold = finalScore;
                                    bestLocation = currentLocation;

                                    // Already passed `loc`, downhill from here on in.
                                    if (bestLocation <= expectedLocation) {
                                        break;
                                    }

                                    // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.
                                    start = Math.max(1, 2 * expectedLocation - bestLocation);
                                }
                            }
                        }

                        // No hope for a (better) match at greater error levels.
                        var _score2 = computeScore$1(pattern, {
                            errors: _i + 1,
                            currentLocation: expectedLocation,
                            expectedLocation: expectedLocation,
                            distance: distance,
                            ignoreLocation: ignoreLocation
                        });
                        if (_score2 > currentThreshold) {
                            break;
                        }
                        lastBitArr = bitArr;
                    }
                    var result = {
                        isMatch: bestLocation >= 0,
                        // Count exact matches (those with a score of 0) to be "almost" exact
                        score: Math.max(0.001, finalScore)
                    };
                    if (computeMatches) {
                        var indices = convertMaskToIndices(matchMask, minMatchCharLength);
                        if (!indices.length) {
                            result.isMatch = false;
                        } else if (includeMatches) {
                            result.indices = indices;
                        }
                    }
                    return result;
                }

                function createPatternAlphabet(pattern) {
                    var mask = {};
                    for (var i = 0, len = pattern.length; i < len; i += 1) {
                        var char = pattern.charAt(i);
                        mask[char] = (mask[char] || 0) | 1 << len - i - 1;
                    }
                    return mask;
                }

                var stripDiacritics = String.prototype.normalize ? function (str) {
                    return str.normalize('NFD').replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, '');
                } : function (str) {
                    return str;
                };
                var BitapSearch = /*#__PURE__*/function () {
                    function BitapSearch(pattern) {
                        var _this5 = this;
                        var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                            _ref6$location = _ref6.location,
                            location = _ref6$location === void 0 ? Config.location : _ref6$location,
                            _ref6$threshold = _ref6.threshold,
                            threshold = _ref6$threshold === void 0 ? Config.threshold : _ref6$threshold,
                            _ref6$distance = _ref6.distance,
                            distance = _ref6$distance === void 0 ? Config.distance : _ref6$distance,
                            _ref6$includeMatches = _ref6.includeMatches,
                            includeMatches = _ref6$includeMatches === void 0 ? Config.includeMatches : _ref6$includeMatches,
                            _ref6$findAllMatches = _ref6.findAllMatches,
                            findAllMatches = _ref6$findAllMatches === void 0 ? Config.findAllMatches : _ref6$findAllMatches,
                            _ref6$minMatchCharLen = _ref6.minMatchCharLength,
                            minMatchCharLength = _ref6$minMatchCharLen === void 0 ? Config.minMatchCharLength : _ref6$minMatchCharLen,
                            _ref6$isCaseSensitive = _ref6.isCaseSensitive,
                            isCaseSensitive = _ref6$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref6$isCaseSensitive,
                            _ref6$ignoreDiacritic = _ref6.ignoreDiacritics,
                            ignoreDiacritics = _ref6$ignoreDiacritic === void 0 ? Config.ignoreDiacritics : _ref6$ignoreDiacritic,
                            _ref6$ignoreLocation = _ref6.ignoreLocation,
                            ignoreLocation = _ref6$ignoreLocation === void 0 ? Config.ignoreLocation : _ref6$ignoreLocation;
                        _classCallCheck(this, BitapSearch);
                        this.options = {
                            location: location,
                            threshold: threshold,
                            distance: distance,
                            includeMatches: includeMatches,
                            findAllMatches: findAllMatches,
                            minMatchCharLength: minMatchCharLength,
                            isCaseSensitive: isCaseSensitive,
                            ignoreDiacritics: ignoreDiacritics,
                            ignoreLocation: ignoreLocation
                        };
                        pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
                        pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
                        this.pattern = pattern;
                        this.chunks = [];
                        if (!this.pattern.length) {
                            return;
                        }
                        var addChunk = function addChunk(pattern, startIndex) {
                            _this5.chunks.push({
                                pattern: pattern,
                                alphabet: createPatternAlphabet(pattern),
                                startIndex: startIndex
                            });
                        };
                        var len = this.pattern.length;
                        if (len > MAX_BITS) {
                            var i = 0;
                            var remainder = len % MAX_BITS;
                            var end = len - remainder;
                            while (i < end) {
                                addChunk(this.pattern.substr(i, MAX_BITS), i);
                                i += MAX_BITS;
                            }
                            if (remainder) {
                                var startIndex = len - MAX_BITS;
                                addChunk(this.pattern.substr(startIndex), startIndex);
                            }
                        } else {
                            addChunk(this.pattern, 0);
                        }
                    }

                    return _createClass(BitapSearch, [{
                        key: "searchIn",
                        value: function searchIn(text) {
                            var _this$options = this.options,
                                isCaseSensitive = _this$options.isCaseSensitive,
                                ignoreDiacritics = _this$options.ignoreDiacritics,
                                includeMatches = _this$options.includeMatches;
                            text = isCaseSensitive ? text : text.toLowerCase();
                            text = ignoreDiacritics ? stripDiacritics(text) : text;

                            // Exact match
                            if (this.pattern === text) {
                                var _result = {
                                    isMatch: true,
                                    score: 0
                                };
                                if (includeMatches) {
                                    _result.indices = [[0, text.length - 1]];
                                }
                                return _result;
                            }

                            // Otherwise, use Bitap algorithm
                            var _this$options2 = this.options,
                                location = _this$options2.location,
                                distance = _this$options2.distance,
                                threshold = _this$options2.threshold,
                                findAllMatches = _this$options2.findAllMatches,
                                minMatchCharLength = _this$options2.minMatchCharLength,
                                ignoreLocation = _this$options2.ignoreLocation;
                            var allIndices = [];
                            var totalScore = 0;
                            var hasMatches = false;
                            this.chunks.forEach(function (_ref7) {
                                var pattern = _ref7.pattern,
                                    alphabet = _ref7.alphabet,
                                    startIndex = _ref7.startIndex;
                                var _search = search(text, pattern, alphabet, {
                                        location: location + startIndex,
                                        distance: distance,
                                        threshold: threshold,
                                        findAllMatches: findAllMatches,
                                        minMatchCharLength: minMatchCharLength,
                                        includeMatches: includeMatches,
                                        ignoreLocation: ignoreLocation
                                    }),
                                    isMatch = _search.isMatch,
                                    score = _search.score,
                                    indices = _search.indices;
                                if (isMatch) {
                                    hasMatches = true;
                                }
                                totalScore += score;
                                if (isMatch && indices) {
                                    allIndices = [].concat(_toConsumableArray(allIndices), _toConsumableArray(indices));
                                }
                            });
                            var result = {
                                isMatch: hasMatches,
                                score: hasMatches ? totalScore / this.chunks.length : 1
                            };
                            if (hasMatches && includeMatches) {
                                result.indices = allIndices;
                            }
                            return result;
                        }
                    }]);
                }();
                var BaseMatch = /*#__PURE__*/function () {
                    function BaseMatch(pattern) {
                        _classCallCheck(this, BaseMatch);
                        this.pattern = pattern;
                    }

                    return _createClass(BaseMatch, [{
                        key: "search",
                        value: function search(/*text*/) {
                        }
                    }], [{
                        key: "isMultiMatch",
                        value: function isMultiMatch(pattern) {
                            return getMatch(pattern, this.multiRegex);
                        }
                    }, {
                        key: "isSingleMatch",
                        value: function isSingleMatch(pattern) {
                            return getMatch(pattern, this.singleRegex);
                        }
                    }]);
                }();

                function getMatch(pattern, exp) {
                    var matches = pattern.match(exp);
                    return matches ? matches[1] : null;
                }

                // Token: 'file
                var ExactMatch = /*#__PURE__*/function (_BaseMatch) {
                    function ExactMatch(pattern) {
                        _classCallCheck(this, ExactMatch);
                        return _callSuper(this, ExactMatch, [pattern]);
                    }

                    _inherits(ExactMatch, _BaseMatch);
                    return _createClass(ExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var isMatch = text === this.pattern;
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [0, this.pattern.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^="(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^=(.*)$/;
                        }
                    }]);
                }(BaseMatch); // Token: !fire
                var InverseExactMatch = /*#__PURE__*/function (_BaseMatch2) {
                    function InverseExactMatch(pattern) {
                        _classCallCheck(this, InverseExactMatch);
                        return _callSuper(this, InverseExactMatch, [pattern]);
                    }

                    _inherits(InverseExactMatch, _BaseMatch2);
                    return _createClass(InverseExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var index = text.indexOf(this.pattern);
                            var isMatch = index === -1;
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [0, text.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'inverse-exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^!"(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^!(.*)$/;
                        }
                    }]);
                }(BaseMatch); // Token: ^file
                var PrefixExactMatch = /*#__PURE__*/function (_BaseMatch3) {
                    function PrefixExactMatch(pattern) {
                        _classCallCheck(this, PrefixExactMatch);
                        return _callSuper(this, PrefixExactMatch, [pattern]);
                    }

                    _inherits(PrefixExactMatch, _BaseMatch3);
                    return _createClass(PrefixExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var isMatch = text.startsWith(this.pattern);
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [0, this.pattern.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'prefix-exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^\^"(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^\^(.*)$/;
                        }
                    }]);
                }(BaseMatch); // Token: !^fire
                var InversePrefixExactMatch = /*#__PURE__*/function (_BaseMatch4) {
                    function InversePrefixExactMatch(pattern) {
                        _classCallCheck(this, InversePrefixExactMatch);
                        return _callSuper(this, InversePrefixExactMatch, [pattern]);
                    }

                    _inherits(InversePrefixExactMatch, _BaseMatch4);
                    return _createClass(InversePrefixExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var isMatch = !text.startsWith(this.pattern);
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [0, text.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'inverse-prefix-exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^!\^"(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^!\^(.*)$/;
                        }
                    }]);
                }(BaseMatch); // Token: .file$
                var SuffixExactMatch = /*#__PURE__*/function (_BaseMatch5) {
                    function SuffixExactMatch(pattern) {
                        _classCallCheck(this, SuffixExactMatch);
                        return _callSuper(this, SuffixExactMatch, [pattern]);
                    }

                    _inherits(SuffixExactMatch, _BaseMatch5);
                    return _createClass(SuffixExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var isMatch = text.endsWith(this.pattern);
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [text.length - this.pattern.length, text.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'suffix-exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^"(.*)"\$$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^(.*)\$$/;
                        }
                    }]);
                }(BaseMatch); // Token: !.file$
                var InverseSuffixExactMatch = /*#__PURE__*/function (_BaseMatch6) {
                    function InverseSuffixExactMatch(pattern) {
                        _classCallCheck(this, InverseSuffixExactMatch);
                        return _callSuper(this, InverseSuffixExactMatch, [pattern]);
                    }

                    _inherits(InverseSuffixExactMatch, _BaseMatch6);
                    return _createClass(InverseSuffixExactMatch, [{
                        key: "search",
                        value: function search(text) {
                            var isMatch = !text.endsWith(this.pattern);
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: [0, text.length - 1]
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'inverse-suffix-exact';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^!"(.*)"\$$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^!(.*)\$$/;
                        }
                    }]);
                }(BaseMatch);
                var FuzzyMatch = /*#__PURE__*/function (_BaseMatch7) {
                    function FuzzyMatch(pattern) {
                        var _this6;
                        var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                            _ref8$location = _ref8.location,
                            location = _ref8$location === void 0 ? Config.location : _ref8$location,
                            _ref8$threshold = _ref8.threshold,
                            threshold = _ref8$threshold === void 0 ? Config.threshold : _ref8$threshold,
                            _ref8$distance = _ref8.distance,
                            distance = _ref8$distance === void 0 ? Config.distance : _ref8$distance,
                            _ref8$includeMatches = _ref8.includeMatches,
                            includeMatches = _ref8$includeMatches === void 0 ? Config.includeMatches : _ref8$includeMatches,
                            _ref8$findAllMatches = _ref8.findAllMatches,
                            findAllMatches = _ref8$findAllMatches === void 0 ? Config.findAllMatches : _ref8$findAllMatches,
                            _ref8$minMatchCharLen = _ref8.minMatchCharLength,
                            minMatchCharLength = _ref8$minMatchCharLen === void 0 ? Config.minMatchCharLength : _ref8$minMatchCharLen,
                            _ref8$isCaseSensitive = _ref8.isCaseSensitive,
                            isCaseSensitive = _ref8$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref8$isCaseSensitive,
                            _ref8$ignoreDiacritic = _ref8.ignoreDiacritics,
                            ignoreDiacritics = _ref8$ignoreDiacritic === void 0 ? Config.ignoreDiacritics : _ref8$ignoreDiacritic,
                            _ref8$ignoreLocation = _ref8.ignoreLocation,
                            ignoreLocation = _ref8$ignoreLocation === void 0 ? Config.ignoreLocation : _ref8$ignoreLocation;
                        _classCallCheck(this, FuzzyMatch);
                        _this6 = _callSuper(this, FuzzyMatch, [pattern]);
                        _this6._bitapSearch = new BitapSearch(pattern, {
                            location: location,
                            threshold: threshold,
                            distance: distance,
                            includeMatches: includeMatches,
                            findAllMatches: findAllMatches,
                            minMatchCharLength: minMatchCharLength,
                            isCaseSensitive: isCaseSensitive,
                            ignoreDiacritics: ignoreDiacritics,
                            ignoreLocation: ignoreLocation
                        });
                        return _this6;
                    }

                    _inherits(FuzzyMatch, _BaseMatch7);
                    return _createClass(FuzzyMatch, [{
                        key: "search",
                        value: function search(text) {
                            return this._bitapSearch.searchIn(text);
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'fuzzy';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^"(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^(.*)$/;
                        }
                    }]);
                }(BaseMatch); // Token: 'file
                var IncludeMatch = /*#__PURE__*/function (_BaseMatch8) {
                    function IncludeMatch(pattern) {
                        _classCallCheck(this, IncludeMatch);
                        return _callSuper(this, IncludeMatch, [pattern]);
                    }

                    _inherits(IncludeMatch, _BaseMatch8);
                    return _createClass(IncludeMatch, [{
                        key: "search",
                        value: function search(text) {
                            var location = 0;
                            var index;
                            var indices = [];
                            var patternLen = this.pattern.length;

                            // Get all exact matches
                            while ((index = text.indexOf(this.pattern, location)) > -1) {
                                location = index + patternLen;
                                indices.push([index, location - 1]);
                            }
                            var isMatch = !!indices.length;
                            return {
                                isMatch: isMatch,
                                score: isMatch ? 0 : 1,
                                indices: indices
                            };
                        }
                    }], [{
                        key: "type",
                        get: function get() {
                            return 'include';
                        }
                    }, {
                        key: "multiRegex",
                        get: function get() {
                            return /^'"(.*)"$/;
                        }
                    }, {
                        key: "singleRegex",
                        get: function get() {
                            return /^'(.*)$/;
                        }
                    }]);
                }(BaseMatch); // ❗Order is important. DO NOT CHANGE.
                var searchers = [ExactMatch, IncludeMatch, PrefixExactMatch, InversePrefixExactMatch, InverseSuffixExactMatch, SuffixExactMatch, InverseExactMatch, FuzzyMatch];
                var searchersLen = searchers.length;

                // Regex to split by spaces, but keep anything in quotes together
                var SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
                var OR_TOKEN = '|';

                // Return a 2D array representation of the query, for simpler parsing.
                // Example:
                // "^core go$ | rb$ | py$ xy$" => [["^core", "go$"], ["rb$"], ["py$", "xy$"]]
                function parseQuery(pattern) {
                    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                    return pattern.split(OR_TOKEN).map(function (item) {
                        var query = item.trim().split(SPACE_RE).filter(function (item) {
                            return item && !!item.trim();
                        });
                        var results = [];
                        for (var i = 0, len = query.length; i < len; i += 1) {
                            var queryItem = query[i];

                            // 1. Handle multiple query match (i.e, once that are quoted, like `"hello world"`)
                            var found = false;
                            var idx = -1;
                            while (!found && ++idx < searchersLen) {
                                var searcher = searchers[idx];
                                var token = searcher.isMultiMatch(queryItem);
                                if (token) {
                                    results.push(new searcher(token, options));
                                    found = true;
                                }
                            }
                            if (found) {
                                continue;
                            }

                            // 2. Handle single query matches (i.e, once that are *not* quoted)
                            idx = -1;
                            while (++idx < searchersLen) {
                                var _searcher = searchers[idx];
                                var _token = _searcher.isSingleMatch(queryItem);
                                if (_token) {
                                    results.push(new _searcher(_token, options));
                                    break;
                                }
                            }
                        }
                        return results;
                    });
                }

                // These extended matchers can return an array of matches, as opposed
                // to a singl match
                var MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);

                /**
                 * Command-like searching
                 * ======================
                 *
                 * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,
                 * search in a given text.
                 *
                 * Search syntax:
                 *
                 * | Token       | Match type                 | Description                            |
                 * | ----------- | -------------------------- | -------------------------------------- |
                 * | `jscript`   | fuzzy-match                | Items that fuzzy match `jscript`       |
                 * | `=scheme`   | exact-match                | Items that are `scheme`                |
                 * | `'python`   | include-match              | Items that include `python`            |
                 * | `!ruby`     | inverse-exact-match        | Items that do not include `ruby`       |
                 * | `^java`     | prefix-exact-match         | Items that start with `java`           |
                 * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |
                 * | `.js$`      | suffix-exact-match         | Items that end with `.js`              |
                 * | `!.go$`     | inverse-suffix-exact-match | Items that do not end with `.go`       |
                 *
                 * A single pipe character acts as an OR operator. For example, the following
                 * query matches entries that start with `core` and end with either`go`, `rb`,
                 * or`py`.
                 *
                 * ```
                 * ^core go$ | rb$ | py$
                 * ```
                 */
                var ExtendedSearch = /*#__PURE__*/function () {
                    function ExtendedSearch(pattern) {
                        var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                            _ref9$isCaseSensitive = _ref9.isCaseSensitive,
                            isCaseSensitive = _ref9$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref9$isCaseSensitive,
                            _ref9$ignoreDiacritic = _ref9.ignoreDiacritics,
                            ignoreDiacritics = _ref9$ignoreDiacritic === void 0 ? Config.ignoreDiacritics : _ref9$ignoreDiacritic,
                            _ref9$includeMatches = _ref9.includeMatches,
                            includeMatches = _ref9$includeMatches === void 0 ? Config.includeMatches : _ref9$includeMatches,
                            _ref9$minMatchCharLen = _ref9.minMatchCharLength,
                            minMatchCharLength = _ref9$minMatchCharLen === void 0 ? Config.minMatchCharLength : _ref9$minMatchCharLen,
                            _ref9$ignoreLocation = _ref9.ignoreLocation,
                            ignoreLocation = _ref9$ignoreLocation === void 0 ? Config.ignoreLocation : _ref9$ignoreLocation,
                            _ref9$findAllMatches = _ref9.findAllMatches,
                            findAllMatches = _ref9$findAllMatches === void 0 ? Config.findAllMatches : _ref9$findAllMatches,
                            _ref9$location = _ref9.location,
                            location = _ref9$location === void 0 ? Config.location : _ref9$location,
                            _ref9$threshold = _ref9.threshold,
                            threshold = _ref9$threshold === void 0 ? Config.threshold : _ref9$threshold,
                            _ref9$distance = _ref9.distance,
                            distance = _ref9$distance === void 0 ? Config.distance : _ref9$distance;
                        _classCallCheck(this, ExtendedSearch);
                        this.query = null;
                        this.options = {
                            isCaseSensitive: isCaseSensitive,
                            ignoreDiacritics: ignoreDiacritics,
                            includeMatches: includeMatches,
                            minMatchCharLength: minMatchCharLength,
                            findAllMatches: findAllMatches,
                            ignoreLocation: ignoreLocation,
                            location: location,
                            threshold: threshold,
                            distance: distance
                        };
                        pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
                        pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
                        this.pattern = pattern;
                        this.query = parseQuery(this.pattern, this.options);
                    }

                    return _createClass(ExtendedSearch, [{
                        key: "searchIn",
                        value: function searchIn(text) {
                            var query = this.query;
                            if (!query) {
                                return {
                                    isMatch: false,
                                    score: 1
                                };
                            }
                            var _this$options3 = this.options,
                                includeMatches = _this$options3.includeMatches,
                                isCaseSensitive = _this$options3.isCaseSensitive,
                                ignoreDiacritics = _this$options3.ignoreDiacritics;
                            text = isCaseSensitive ? text : text.toLowerCase();
                            text = ignoreDiacritics ? stripDiacritics(text) : text;
                            var numMatches = 0;
                            var allIndices = [];
                            var totalScore = 0;

                            // ORs
                            for (var i = 0, qLen = query.length; i < qLen; i += 1) {
                                var _searchers = query[i];

                                // Reset indices
                                allIndices.length = 0;
                                numMatches = 0;

                                // ANDs
                                for (var j = 0, pLen = _searchers.length; j < pLen; j += 1) {
                                    var searcher = _searchers[j];
                                    var _searcher$search = searcher.search(text),
                                        isMatch = _searcher$search.isMatch,
                                        indices = _searcher$search.indices,
                                        score = _searcher$search.score;
                                    if (isMatch) {
                                        numMatches += 1;
                                        totalScore += score;
                                        if (includeMatches) {
                                            var type = searcher.constructor.type;
                                            if (MultiMatchSet.has(type)) {
                                                allIndices = [].concat(_toConsumableArray(allIndices), _toConsumableArray(indices));
                                            } else {
                                                allIndices.push(indices);
                                            }
                                        }
                                    } else {
                                        totalScore = 0;
                                        numMatches = 0;
                                        allIndices.length = 0;
                                        break;
                                    }
                                }

                                // OR condition, so if TRUE, return
                                if (numMatches) {
                                    var result = {
                                        isMatch: true,
                                        score: totalScore / numMatches
                                    };
                                    if (includeMatches) {
                                        result.indices = allIndices;
                                    }
                                    return result;
                                }
                            }

                            // Nothing was matched
                            return {
                                isMatch: false,
                                score: 1
                            };
                        }
                    }], [{
                        key: "condition",
                        value: function condition(_, options) {
                            return options.useExtendedSearch;
                        }
                    }]);
                }();
                var registeredSearchers = [];

                function register() {
                    registeredSearchers.push.apply(registeredSearchers, arguments);
                }

                function createSearcher(pattern, options) {
                    for (var i = 0, len = registeredSearchers.length; i < len; i += 1) {
                        var searcherClass = registeredSearchers[i];
                        if (searcherClass.condition(pattern, options)) {
                            return new searcherClass(pattern, options);
                        }
                    }
                    return new BitapSearch(pattern, options);
                }

                var LogicalOperator = {
                    AND: '$and',
                    OR: '$or'
                };
                var KeyType = {
                    PATH: '$path',
                    PATTERN: '$val'
                };
                var isExpression = function isExpression(query) {
                    return !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
                };
                var isPath = function isPath(query) {
                    return !!query[KeyType.PATH];
                };
                var isLeaf = function isLeaf(query) {
                    return !isArray(query) && isObject(query) && !isExpression(query);
                };
                var convertToExplicit = function convertToExplicit(query) {
                    return _defineProperty({}, LogicalOperator.AND, Object.keys(query).map(function (key) {
                        return _defineProperty({}, key, query[key]);
                    }));
                };

                // When `auto` is `true`, the parse function will infer and initialize and add
                // the appropriate `Searcher` instance
                function parse(query, options) {
                    var _ref12 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
                        _ref12$auto = _ref12.auto,
                        auto = _ref12$auto === void 0 ? true : _ref12$auto;
                    var _next = function next(query) {
                        var keys = Object.keys(query);
                        var isQueryPath = isPath(query);
                        if (!isQueryPath && keys.length > 1 && !isExpression(query)) {
                            return _next(convertToExplicit(query));
                        }
                        if (isLeaf(query)) {
                            var key = isQueryPath ? query[KeyType.PATH] : keys[0];
                            var pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];
                            if (!isString(pattern)) {
                                throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
                            }
                            var obj = {
                                keyId: createKeyId(key),
                                pattern: pattern
                            };
                            if (auto) {
                                obj.searcher = createSearcher(pattern, options);
                            }
                            return obj;
                        }
                        var node = {
                            children: [],
                            operator: keys[0]
                        };
                        keys.forEach(function (key) {
                            var value = query[key];
                            if (isArray(value)) {
                                value.forEach(function (item) {
                                    node.children.push(_next(item));
                                });
                            }
                        });
                        return node;
                    };
                    if (!isExpression(query)) {
                        query = convertToExplicit(query);
                    }
                    return _next(query);
                }

                // Practical scoring function
                function computeScore(results, _ref13) {
                    var _ref13$ignoreFieldNor = _ref13.ignoreFieldNorm,
                        ignoreFieldNorm = _ref13$ignoreFieldNor === void 0 ? Config.ignoreFieldNorm : _ref13$ignoreFieldNor;
                    results.forEach(function (result) {
                        var totalScore = 1;
                        result.matches.forEach(function (_ref14) {
                            var key = _ref14.key,
                                norm = _ref14.norm,
                                score = _ref14.score;
                            var weight = key ? key.weight : null;
                            totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm));
                        });
                        result.score = totalScore;
                    });
                }

                function transformMatches(result, data) {
                    var matches = result.matches;
                    data.matches = [];
                    if (!isDefined(matches)) {
                        return;
                    }
                    matches.forEach(function (match) {
                        if (!isDefined(match.indices) || !match.indices.length) {
                            return;
                        }
                        var indices = match.indices,
                            value = match.value;
                        var obj = {
                            indices: indices,
                            value: value
                        };
                        if (match.key) {
                            obj.key = match.key.src;
                        }
                        if (match.idx > -1) {
                            obj.refIndex = match.idx;
                        }
                        data.matches.push(obj);
                    });
                }

                function transformScore(result, data) {
                    data.score = result.score;
                }

                function format(results, docs) {
                    var _ref15 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
                        _ref15$includeMatches = _ref15.includeMatches,
                        includeMatches = _ref15$includeMatches === void 0 ? Config.includeMatches : _ref15$includeMatches,
                        _ref15$includeScore = _ref15.includeScore,
                        includeScore = _ref15$includeScore === void 0 ? Config.includeScore : _ref15$includeScore;
                    var transformers = [];
                    if (includeMatches) transformers.push(transformMatches);
                    if (includeScore) transformers.push(transformScore);
                    return results.map(function (result) {
                        var idx = result.idx;
                        var data = {
                            item: docs[idx],
                            refIndex: idx
                        };
                        if (transformers.length) {
                            transformers.forEach(function (transformer) {
                                transformer(result, data);
                            });
                        }
                        return data;
                    });
                }

                var Fuse = /*#__PURE__*/function () {
                    function Fuse(docs) {
                        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                        var index = arguments.length > 2 ? arguments[2] : undefined;
                        _classCallCheck(this, Fuse);
                        this.options = _objectSpread(_objectSpread({}, Config), options);
                        if (this.options.useExtendedSearch && false) ;
                        this._keyStore = new KeyStore(this.options.keys);
                        this.setCollection(docs, index);
                    }

                    return _createClass(Fuse, [{
                        key: "setCollection",
                        value: function setCollection(docs, index) {
                            this._docs = docs;
                            if (index && !(index instanceof FuseIndex)) {
                                throw new Error(INCORRECT_INDEX_TYPE);
                            }
                            this._myIndex = index || createIndex(this.options.keys, this._docs, {
                                getFn: this.options.getFn,
                                fieldNormWeight: this.options.fieldNormWeight
                            });
                        }
                    }, {
                        key: "add",
                        value: function add(doc) {
                            if (!isDefined(doc)) {
                                return;
                            }
                            this._docs.push(doc);
                            this._myIndex.add(doc);
                        }
                    }, {
                        key: "remove",
                        value: function remove() {
                            var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function /* doc, idx */() {
                                return false;
                            };
                            var results = [];
                            for (var i = 0, len = this._docs.length; i < len; i += 1) {
                                var doc = this._docs[i];
                                if (predicate(doc, i)) {
                                    this.removeAt(i);
                                    i -= 1;
                                    len -= 1;
                                    results.push(doc);
                                }
                            }
                            return results;
                        }
                    }, {
                        key: "removeAt",
                        value: function removeAt(idx) {
                            this._docs.splice(idx, 1);
                            this._myIndex.removeAt(idx);
                        }
                    }, {
                        key: "getIndex",
                        value: function getIndex() {
                            return this._myIndex;
                        }
                    }, {
                        key: "search",
                        value: function search(query) {
                            var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
                                _ref16$limit = _ref16.limit,
                                limit = _ref16$limit === void 0 ? -1 : _ref16$limit;
                            var _this$options4 = this.options,
                                includeMatches = _this$options4.includeMatches,
                                includeScore = _this$options4.includeScore,
                                shouldSort = _this$options4.shouldSort,
                                sortFn = _this$options4.sortFn,
                                ignoreFieldNorm = _this$options4.ignoreFieldNorm;
                            var results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
                            computeScore(results, {
                                ignoreFieldNorm: ignoreFieldNorm
                            });
                            if (shouldSort) {
                                results.sort(sortFn);
                            }
                            if (isNumber(limit) && limit > -1) {
                                results = results.slice(0, limit);
                            }
                            return format(results, this._docs, {
                                includeMatches: includeMatches,
                                includeScore: includeScore
                            });
                        }
                    }, {
                        key: "_searchStringList",
                        value: function _searchStringList(query) {
                            var searcher = createSearcher(query, this.options);
                            var records = this._myIndex.records;
                            var results = [];

                            // Iterate over every string in the index
                            records.forEach(function (_ref17) {
                                var text = _ref17.v,
                                    idx = _ref17.i,
                                    norm = _ref17.n;
                                if (!isDefined(text)) {
                                    return;
                                }
                                var _searcher$searchIn = searcher.searchIn(text),
                                    isMatch = _searcher$searchIn.isMatch,
                                    score = _searcher$searchIn.score,
                                    indices = _searcher$searchIn.indices;
                                if (isMatch) {
                                    results.push({
                                        item: text,
                                        idx: idx,
                                        matches: [{
                                            score: score,
                                            value: text,
                                            norm: norm,
                                            indices: indices
                                        }]
                                    });
                                }
                            });
                            return results;
                        }
                    }, {
                        key: "_searchLogical",
                        value: function _searchLogical(query) {
                            var _this7 = this;
                            var expression = parse(query, this.options);
                            var _evaluate = function evaluate(node, item, idx) {
                                if (!node.children) {
                                    var keyId = node.keyId,
                                        searcher = node.searcher;
                                    var matches = _this7._findMatches({
                                        key: _this7._keyStore.get(keyId),
                                        value: _this7._myIndex.getValueForItemAtKeyId(item, keyId),
                                        searcher: searcher
                                    });
                                    if (matches && matches.length) {
                                        return [{
                                            idx: idx,
                                            item: item,
                                            matches: matches
                                        }];
                                    }
                                    return [];
                                }
                                var res = [];
                                for (var i = 0, len = node.children.length; i < len; i += 1) {
                                    var child = node.children[i];
                                    var result = _evaluate(child, item, idx);
                                    if (result.length) {
                                        res.push.apply(res, _toConsumableArray(result));
                                    } else if (node.operator === LogicalOperator.AND) {
                                        return [];
                                    }
                                }
                                return res;
                            };
                            var records = this._myIndex.records;
                            var resultMap = {};
                            var results = [];
                            records.forEach(function (_ref18) {
                                var item = _ref18.$,
                                    idx = _ref18.i;
                                if (isDefined(item)) {
                                    var expResults = _evaluate(expression, item, idx);
                                    if (expResults.length) {
                                        // Dedupe when adding
                                        if (!resultMap[idx]) {
                                            resultMap[idx] = {
                                                idx: idx,
                                                item: item,
                                                matches: []
                                            };
                                            results.push(resultMap[idx]);
                                        }
                                        expResults.forEach(function (_ref19) {
                                            var _resultMap$idx$matche;
                                            var matches = _ref19.matches;
                                            (_resultMap$idx$matche = resultMap[idx].matches).push.apply(_resultMap$idx$matche, _toConsumableArray(matches));
                                        });
                                    }
                                }
                            });
                            return results;
                        }
                    }, {
                        key: "_searchObjectList",
                        value: function _searchObjectList(query) {
                            var _this8 = this;
                            var searcher = createSearcher(query, this.options);
                            var _this$_myIndex = this._myIndex,
                                keys = _this$_myIndex.keys,
                                records = _this$_myIndex.records;
                            var results = [];

                            // List is Array<Object>
                            records.forEach(function (_ref20) {
                                var item = _ref20.$,
                                    idx = _ref20.i;
                                if (!isDefined(item)) {
                                    return;
                                }
                                var matches = [];

                                // Iterate over every key (i.e, path), and fetch the value at that key
                                keys.forEach(function (key, keyIndex) {
                                    matches.push.apply(matches, _toConsumableArray(_this8._findMatches({
                                        key: key,
                                        value: item[keyIndex],
                                        searcher: searcher
                                    })));
                                });
                                if (matches.length) {
                                    results.push({
                                        idx: idx,
                                        item: item,
                                        matches: matches
                                    });
                                }
                            });
                            return results;
                        }
                    }, {
                        key: "_findMatches",
                        value: function _findMatches(_ref21) {
                            var key = _ref21.key,
                                value = _ref21.value,
                                searcher = _ref21.searcher;
                            if (!isDefined(value)) {
                                return [];
                            }
                            var matches = [];
                            if (isArray(value)) {
                                value.forEach(function (_ref22) {
                                    var text = _ref22.v,
                                        idx = _ref22.i,
                                        norm = _ref22.n;
                                    if (!isDefined(text)) {
                                        return;
                                    }
                                    var _searcher$searchIn2 = searcher.searchIn(text),
                                        isMatch = _searcher$searchIn2.isMatch,
                                        score = _searcher$searchIn2.score,
                                        indices = _searcher$searchIn2.indices;
                                    if (isMatch) {
                                        matches.push({
                                            score: score,
                                            key: key,
                                            value: text,
                                            idx: idx,
                                            norm: norm,
                                            indices: indices
                                        });
                                    }
                                });
                            } else {
                                var text = value.v,
                                    _norm = value.n;
                                var _searcher$searchIn3 = searcher.searchIn(text),
                                    isMatch = _searcher$searchIn3.isMatch,
                                    score = _searcher$searchIn3.score,
                                    indices = _searcher$searchIn3.indices;
                                if (isMatch) {
                                    matches.push({
                                        score: score,
                                        key: key,
                                        value: text,
                                        norm: _norm,
                                        indices: indices
                                    });
                                }
                            }
                            return matches;
                        }
                    }]);
                }();
                Fuse.version = '7.1.0';
                Fuse.createIndex = createIndex;
                Fuse.parseIndex = parseIndex;
                Fuse.config = Config;
                {
                    Fuse.parseQuery = parse;
                }
                {
                    register(ExtendedSearch);
                }
                var _hoisted_1$3 = {
                    class: "h-full w-640px flex flex-col"
                };
                var _hoisted_2$3 = {
                    flex: "~ gap2 none items-center justify-between",
                    border: "b base",
                    class: "relative bg-hover px-4 py-1"
                };
                var _hoisted_3$3 = {
                    class: "font-600"
                };
                var _hoisted_4$3 = {
                    class: "flex-1 overflow-y-overlay p-3"
                };
                var _sfc_main$4 = /* @__PURE__ */defineComponent({
                    __name: "model-detail-drawer",
                    props: /* @__PURE__ */mergeModels({
                        model: {}
                    }, {
                        "modelValue": {
                            type: Boolean
                        },
                        "modelModifiers": {}
                    }),
                    emits: ["update:modelValue"],
                    setup: function setup(__props) {
                        var props = __props;
                        var show = useModel(__props, "modelValue");
                        var formatedModel = computed(function () {
                            if (!props.model) return null;
                            var decodedModel = _objectSpread(_objectSpread({}, props.model), {}, {
                                sql: void 0,
                                createTime: props.model.createTime ? formatToDateTime(props.model.createTime) : void 0,
                                updateTime: props.model.updateTime ? formatToDateTime(props.model.updateTime) : void 0
                            });
                            return JSON.stringify(decodedModel, null, 2);
                        });
                        var _useCopy = useCopy(),
                            copy = _useCopy.copy,
                            copied = _useCopy.copied;
                        var _useCopy2 = useCopy(),
                            copySql = _useCopy2.copy,
                            sqlCopied = _useCopy2.copied;
                        return function (_ctx, _cache) {
                            var _component_ShikiCode = _sfc_main$7;
                            var _component_SimpleCollapse = _sfc_main$8;
                            var _component_Empty = _sfc_main$9;
                            var _component_SimpleDrawer = _sfc_main$6;
                            return openBlock(), createBlock(_component_SimpleDrawer, {
                                modelValue: show.value,
                                "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) {
                                    return show.value = $event;
                                })
                            }, {
                                default: withCtx(function () {
                                    var _ctx$model, _ctx$model2, _ctx$model3;
                                    return [createBaseVNode("div", _hoisted_1$3, [createBaseVNode("div", _hoisted_2$3, [createBaseVNode("span", _hoisted_3$3, "模型【" + toDisplayString((_ctx$model = _ctx.model) === null || _ctx$model === void 0 ? void 0 : _ctx$model.modelName) + " - " + toDisplayString((_ctx$model2 = _ctx.model) === null || _ctx$model2 === void 0 ? void 0 : _ctx$model2.id) + "】详情", 1)]), createBaseVNode("div", _hoisted_4$3, [unref(formatedModel) ? (openBlock(), createElementBlock(Fragment, {
                                        key: 0
                                    }, [createVNode(_component_SimpleCollapse, {
                                        "model-value": true,
                                        "header-class": "bg-selected"
                                    }, {
                                        title: withCtx(function () {
                                            return _cache[3] || (_cache[3] = [createTextVNode(" 基本信息 ")]);
                                        }),
                                        actions: withCtx(function () {
                                            return [createBaseVNode("button", {
                                                class: "a-primary",
                                                onClick: _cache[0] || (_cache[0] = function ($event) {
                                                    return unref(copy)(unref(formatedModel));
                                                })
                                            }, toDisplayString(unref(copied) ? "✓ 已复制" : "复制"), 1)];
                                        }),
                                        default: withCtx(function () {
                                            return [createVNode(_component_ShikiCode, {
                                                code: unref(formatedModel),
                                                lang: "json",
                                                class: "bg-blue/10 text-0.9rem"
                                            }, null, 8, ["code"])];
                                        }),
                                        _: 1
                                    }), (_ctx$model3 = _ctx.model) !== null && _ctx$model3 !== void 0 && _ctx$model3.sql ? (openBlock(), createBlock(_component_SimpleCollapse, {
                                        key: 0,
                                        "model-value": true,
                                        class: "mt-3",
                                        "header-class": "bg-selected"
                                    }, {
                                        title: withCtx(function () {
                                            return _cache[4] || (_cache[4] = [createTextVNode(" SQL 信息 ")]);
                                        }),
                                        actions: withCtx(function () {
                                            return [createBaseVNode("button", {
                                                class: "a-primary",
                                                onClick: _cache[1] || (_cache[1] = function ($event) {
                                                    var _ctx$model4;
                                                    return unref(copySql)((_ctx$model4 = _ctx.model) === null || _ctx$model4 === void 0 ? void 0 : _ctx$model4.sql);
                                                })
                                            }, toDisplayString(unref(sqlCopied) ? "✓ 已复制" : "复制"), 1)];
                                        }),
                                        default: withCtx(function () {
                                            return [createVNode(_component_ShikiCode, {
                                                code: _ctx.model.sql,
                                                lang: "sql",
                                                class: "bg-yellow/10 text-0.9rem"
                                            }, null, 8, ["code"])];
                                        }),
                                        _: 1
                                    })) : createCommentVNode("", true)], 64)) : (openBlock(), createBlock(_component_Empty, {
                                        key: 1,
                                        class: "h-full"
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[5] || (_cache[5] = [createTextVNode(" 暂无详情 ")]);
                                        }),
                                        _: 1
                                    }))])])];
                                }),
                                _: 1
                            }, 8, ["modelValue"]);
                        };
                    }
                });
                var _hoisted_1$2 = {
                    class: "w-36 flex flex-col gap-1 p1 text-0.9rem"
                };
                var _hoisted_2$2 = ["title"];
                var _hoisted_3$2 = {
                    class: "flex flex-wrap items-center gap-2"
                };
                var _hoisted_4$2 = {
                    class: "relative mt-auto flex items-center gap-2"
                };
                var _hoisted_5$2 = ["title"];
                var _sfc_main$3 = /* @__PURE__ */defineComponent({
                    __name: "model-item",
                    props: {
                        model: {},
                        viewType: {}
                    },
                    emits: ["showDetail", "showEdit", "delete", "showPegging", "showJobs", "createJob"],
                    setup: function setup(__props) {
                        useCssVars(function (_ctx) {
                            return {
                                "1c368f7c": unref(hoverBgStyle),
                                "304a35a4": unref(scopeStyle).color
                            };
                        });
                        var props = __props;
                        var _createReusableTempla = createReusableTemplate(),
                            _createReusableTempla2 = _slicedToArray(_createReusableTempla, 2),
                            DefineDropdown = _createReusableTempla2[0],
                            ReuseDropdown = _createReusableTempla2[1];
                        var showMenu = ref(false);
                        var groupStyle = computed(function () {
                            return {
                                background: "linear-gradient(135deg, ".concat(getHashColorFromString(props.model.scope || "", 0.08), ", ").concat(getHashColorFromString(props.model.scope || "", 0), ")"),
                                borderColor: getHashColorFromString(props.model.scope || "", 0.3)
                            };
                        });
                        var hoverBgStyle = computed(function () {
                            return "linear-gradient(135deg, ".concat(getHashColorFromString(props.model.scope || "", 0.15), ", ").concat(getHashColorFromString(props.model.scope || "", 0), ")");
                        });
                        var scopeStyle = computed(function () {
                            return {
                                backgroundColor: getHashColorFromString(props.model.scope || "", 0.1),
                                color: getHashColorFromString(props.model.scope || "", 1)
                            };
                        });
                        return function (_ctx, _cache) {
                            var _component_VDropdown = resolveComponent("VDropdown");
                            return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineDropdown), null, {
                                default: withCtx(function () {
                                    return [createVNode(_component_VDropdown, {
                                        shown: unref(showMenu),
                                        "onUpdate:shown": _cache[6] || (_cache[6] = function ($event) {
                                            return isRef(showMenu) ? showMenu.value = $event : null;
                                        }),
                                        "popper-class": "no-arrow",
                                        placement: "bottom-end",
                                        "popper-triggers": ["hover"]
                                    }, {
                                        popper: withCtx(function () {
                                            return [createBaseVNode("div", _hoisted_1$2, [createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-gray/15",
                                                onClick: _cache[0] || (_cache[0] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("showDetail");
                                                })
                                            }, _cache[10] || (_cache[10] = [createBaseVNode("span", {
                                                class: "op80"
                                            }, "详情", -1)])), createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-gray/15",
                                                onClick: _cache[1] || (_cache[1] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("showEdit");
                                                })
                                            }, _cache[11] || (_cache[11] = [createBaseVNode("span", {
                                                class: "op80"
                                            }, "编辑", -1)])), _cache[16] || (_cache[16] = createBaseVNode("div", {
                                                class: "h-1px w-full bg-gray/20"
                                            }, null, -1)), createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-gray/15",
                                                onClick: _cache[2] || (_cache[2] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("createJob");
                                                })
                                            }, _cache[12] || (_cache[12] = [createBaseVNode("div", {
                                                class: "flex items-center gap-1 op80"
                                            }, [createTextVNode(" 创建任务 "), createBaseVNode("div", {
                                                class: "i-ph:arrow-up-right"
                                            })], -1)])), createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-gray/15",
                                                onClick: _cache[3] || (_cache[3] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("showJobs");
                                                })
                                            }, _cache[13] || (_cache[13] = [createBaseVNode("div", {
                                                class: "flex items-center gap-1 op80"
                                            }, [createTextVNode(" 查看关联任务 "), createBaseVNode("div", {
                                                class: "i-ph:arrow-up-right"
                                            })], -1)])), createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-gray/15",
                                                onClick: _cache[4] || (_cache[4] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("showPegging");
                                                })
                                            }, _cache[14] || (_cache[14] = [createBaseVNode("span", {
                                                class: "op80"
                                            }, "反查绑定关系", -1)])), _cache[17] || (_cache[17] = createBaseVNode("div", {
                                                class: "h-1px w-full bg-gray/20"
                                            }, null, -1)), createBaseVNode("button", {
                                                class: "rounded-md px3 py1 text-left hover:bg-red/10",
                                                onClick: _cache[5] || (_cache[5] = function ($event) {
                                                    showMenu.value = false;
                                                    _ctx.$emit("delete");
                                                })
                                            }, _cache[15] || (_cache[15] = [createBaseVNode("span", {
                                                class: "text-red"
                                            }, "删除", -1)]))])];
                                        }),
                                        default: withCtx(function () {
                                            return [createBaseVNode("div", {
                                                class: normalizeClass(["h-6 w-6 flex-center flex-none cursor-pointer rounded op0 hover:bg-gray/30 group-hover:op70", {
                                                    "op70 bg-gray/30": unref(showMenu)
                                                }])
                                            }, _cache[9] || (_cache[9] = [createBaseVNode("div", {
                                                class: "i-ph:dots-three-outline-fill op60"
                                            }, null, -1)]), 2)];
                                        }),
                                        _: 1
                                    }, 8, ["shown"])];
                                }),
                                _: 1
                            }), _ctx.viewType === "grid" ? (openBlock(), createElementBlock("div", {
                                key: 0,
                                class: "group relative flex flex-col gap-3 border-2px rounded-lg bg-op10 px-4 py3",
                                style: normalizeStyle(unref(groupStyle))
                            }, [createBaseVNode("div", {
                                class: normalizeClass(["absolute right-1 top-1 overflow-hidden text-3rem op6", _ctx.model.modelType === "graph" ? "i-carbon:network-4" : "i-carbon:table-split"]),
                                style: normalizeStyle({
                                    color: unref(scopeStyle).color
                                })
                            }, null, 6), createBaseVNode("div", {
                                class: "model-name w-fit cursor-pointer color-gray-500 font-600",
                                onClick: _cache[7] || (_cache[7] = function ($event) {
                                    return _ctx.$emit("showDetail");
                                })
                            }, toDisplayString(_ctx.model.modelName), 1), createBaseVNode("div", {
                                class: "line-clamp-2 h-10 text-sm op50",
                                title: _ctx.model.description
                            }, toDisplayString(_ctx.model.description), 9, _hoisted_2$2), createBaseVNode("div", _hoisted_3$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(JSON.parse(_ctx.model.tags || "[]"), function (tag) {
                                return openBlock(), createElementBlock("span", {
                                    key: tag,
                                    class: "rounded bg-gray/20 px2 py1 text-xs color-fade"
                                }, " #" + toDisplayString(tag), 1);
                            }), 128))]), createBaseVNode("div", _hoisted_4$2, [createBaseVNode("div", {
                                class: "badge rounded-full text-0.8rem",
                                style: normalizeStyle(unref(scopeStyle))
                            }, toDisplayString(_ctx.model.scope), 5), _cache[18] || (_cache[18] = createBaseVNode("div", {
                                class: "flex-auto"
                            }, null, -1)), createVNode(unref(ReuseDropdown))])], 4)) : _ctx.viewType === "list" ? (openBlock(), createElementBlock("div", {
                                key: 1,
                                class: "group flex items-center gap-2 border-2px rounded-md bg-op10 px-3 py-2",
                                style: normalizeStyle(unref(groupStyle))
                            }, [createBaseVNode("div", {
                                class: normalizeClass(["flex-none op70", _ctx.model.modelType === "graph" ? "i-carbon:network-4" : "i-carbon:table-split"]),
                                style: normalizeStyle({
                                    color: unref(scopeStyle).color
                                })
                            }, null, 6), createBaseVNode("div", {
                                class: "model-name w-fit cursor-pointer color-gray-500 font-600",
                                onClick: _cache[8] || (_cache[8] = function ($event) {
                                    return _ctx.$emit("showDetail");
                                })
                            }, toDisplayString(_ctx.model.modelName), 1), createBaseVNode("div", {
                                class: "mx-2 badge rounded-full px-2.5 text-0.8rem",
                                style: normalizeStyle(unref(scopeStyle))
                            }, toDisplayString(_ctx.model.scope), 5), createBaseVNode("div", {
                                class: "line-clamp-1 flex-[4_1_0] text-sm op50",
                                title: _ctx.model.description
                            }, toDisplayString(_ctx.model.description), 9, _hoisted_5$2), _cache[19] || (_cache[19] = createBaseVNode("div", {
                                class: "flex-auto"
                            }, null, -1)), createVNode(unref(ReuseDropdown))], 4)) : createCommentVNode("", true)], 64);
                        };
                    }
                });

                /* unplugin-vue-components disabled */

                var ModelItem = /* @__PURE__ */_export_sfc(_sfc_main$3, [["__scopeId", "data-v-ba445398"]]);
                var _sfc_main$2 = /* @__PURE__ */defineComponent({
                    __name: "SimpleTitle",
                    props: {
                        bar: {
                            type: Boolean
                        }
                    },
                    setup: function setup(__props) {
                        return function (_ctx, _cache) {
                            return openBlock(), createElementBlock("span", {
                                class: normalizeClass(["relative flex whitespace-nowrap", [{
                                    "pl-10px bar": _ctx.bar && _ctx.$slots.default
                                }]])
                            }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 2);
                        };
                    }
                });

                /* unplugin-vue-components disabled */

                var __unplugin_components_0 = /* @__PURE__ */_export_sfc(_sfc_main$2, [["__scopeId", "data-v-f49db258"]]);
                var _hoisted_1$1 = {
                    class: "h-full w-800px flex flex-col"
                };
                var _hoisted_2$1 = {
                    flex: "~ gap2 none items-center justify-between",
                    border: "b base",
                    class: "relative bg-hover px-4 py-1"
                };
                var _hoisted_3$1 = {
                    class: "font-600"
                };
                var _hoisted_4$1 = {
                    class: "flex flex-1 flex-col gap-4 overflow-y-overlay p-4"
                };
                var _hoisted_5$1 = {
                    class: "flex items-center gap-2"
                };
                var _hoisted_6$1 = {
                    class: "form-group w-40%"
                };
                var _hoisted_7$1 = ["value"];
                var _hoisted_8$1 = {
                    class: "form-group w-30%"
                };
                var _hoisted_9$1 = {
                    class: "form-group w-30%"
                };
                var _hoisted_10$1 = {
                    key: 1
                };
                var _hoisted_11$1 = {
                    class: "color-base"
                };
                var _hoisted_12$1 = {
                    class: "green-badge"
                };
                var _hoisted_13$1 = {
                    class: "blue-badge"
                };
                var _sfc_main$1 = /* @__PURE__ */defineComponent({
                    __name: "model-pegging-drawer",
                    props: /* @__PURE__ */mergeModels({
                        model: {}
                    }, {
                        "modelValue": {
                            type: Boolean
                        },
                        "modelModifiers": {}
                    }),
                    emits: ["update:modelValue"],
                    setup: function setup(__props) {
                        var props = __props;
                        var show = useModel(__props, "modelValue");
                        var peggingList = ref([]);

                        function getPeggingList() {
                            var _props$model;
                            getModelPeggings({
                                modelId: (_props$model = props.model) === null || _props$model === void 0 ? void 0 : _props$model.id
                            }).then(function (res) {
                                peggingList.value = res.data;
                            }).catch(function () {
                                peggingList.value = [];
                            });
                        }

                        onMounted(function () {
                            getPeggingList();
                        });

                        function handlePeggingInfo(item) {
                            var _item$key$find, _item$key$find2;
                            var key = Object.keys(item)[0];
                            var countScriptId = (_item$key$find = item[key].find(function (i) {
                                return i.scriptType === "COUNT";
                            })) === null || _item$key$find === void 0 ? void 0 : _item$key$find.scriptId;
                            var dataScriptId = (_item$key$find2 = item[key].find(function (i) {
                                return i.scriptType === "DATA";
                            })) === null || _item$key$find2 === void 0 ? void 0 : _item$key$find2.scriptId;
                            return {
                                key: key,
                                countScriptId: countScriptId,
                                dataScriptId: dataScriptId
                            };
                        }

                        var formInfo = ref({
                            columnName: "",
                            countScriptId: "",
                            dataScriptId: ""
                        });

                        function handleCreatePegging() {
                            var _props$model2;
                            if (!formInfo.value.columnName || !formInfo.value.countScriptId || !formInfo.value.dataScriptId) {
                                api.warning("请输入完整信息");
                                return;
                            }
                            var params = _objectSpread({
                                modelId: (_props$model2 = props.model) === null || _props$model2 === void 0 ? void 0 : _props$model2.id
                            }, formInfo.value);
                            createModelPeggingMap(params).then(function () {
                                api.success("创建成功");
                                getPeggingList();
                            });
                        }

                        return function (_ctx, _cache) {
                            var _component_SimpleTitle = __unplugin_components_0;
                            var _component_SimpleSelect = _sfc_main$a;
                            var _component_SimpleInput = _sfc_main$b;
                            var _component_SimpleButton = _sfc_main$c;
                            var _component_Empty = _sfc_main$9;
                            var _component_SimpleDrawer = _sfc_main$6;
                            return openBlock(), createBlock(_component_SimpleDrawer, {
                                modelValue: show.value,
                                "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
                                    return show.value = $event;
                                })
                            }, {
                                default: withCtx(function () {
                                    var _ctx$model5, _ctx$model6;
                                    return [createBaseVNode("div", _hoisted_1$1, [createBaseVNode("div", _hoisted_2$1, [createBaseVNode("span", _hoisted_3$1, "模型【" + toDisplayString((_ctx$model5 = _ctx.model) === null || _ctx$model5 === void 0 ? void 0 : _ctx$model5.modelName) + " - " + toDisplayString((_ctx$model6 = _ctx.model) === null || _ctx$model6 === void 0 ? void 0 : _ctx$model6.id) + "】反查绑定", 1)]), createBaseVNode("div", _hoisted_4$1, [createVNode(_component_SimpleTitle, {
                                        bar: "",
                                        class: "font-600"
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[4] || (_cache[4] = [createTextVNode(" 创建反查绑定关系 ")]);
                                        }),
                                        _: 1
                                    }), createBaseVNode("div", _hoisted_5$1, [createBaseVNode("div", _hoisted_6$1, [_cache[5] || (_cache[5] = createBaseVNode("label", null, [createBaseVNode("span", {
                                        "text-red-500": ""
                                    }, "*"), createTextVNode(" COLUMN_NAME")], -1)), createVNode(_component_SimpleSelect, {
                                        modelValue: unref(formInfo).columnName,
                                        "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
                                            return unref(formInfo).columnName = $event;
                                        }),
                                        placeholder: "请选择"
                                    }, {
                                        default: withCtx(function () {
                                            var _ctx$model7;
                                            return [(openBlock(true), createElementBlock(Fragment, null, renderList(((_ctx$model7 = _ctx.model) === null || _ctx$model7 === void 0 ? void 0 : _ctx$model7.resultMeta) || [], function (item) {
                                                return openBlock(), createElementBlock("option", {
                                                    key: item,
                                                    value: item.columnName
                                                }, toDisplayString(item.desc) + " - " + toDisplayString(item.columnName), 9, _hoisted_7$1);
                                            }), 128))];
                                        }),
                                        _: 1
                                    }, 8, ["modelValue"])]), createBaseVNode("div", _hoisted_8$1, [_cache[6] || (_cache[6] = createBaseVNode("label", null, [createBaseVNode("span", {
                                        "text-red-500": ""
                                    }, "*"), createTextVNode(" COUNT_ID")], -1)), createVNode(_component_SimpleInput, {
                                        modelValue: unref(formInfo).countScriptId,
                                        "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) {
                                            return unref(formInfo).countScriptId = $event;
                                        }),
                                        modelModifiers: {
                                            trim: true
                                        },
                                        maxlength: 32,
                                        placeholder: "请输入"
                                    }, null, 8, ["modelValue"])]), createBaseVNode("div", _hoisted_9$1, [_cache[7] || (_cache[7] = createBaseVNode("label", null, [createBaseVNode("span", {
                                        "text-red-500": ""
                                    }, "*"), createTextVNode(" DATA_ID")], -1)), createVNode(_component_SimpleInput, {
                                        modelValue: unref(formInfo).dataScriptId,
                                        "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) {
                                            return unref(formInfo).dataScriptId = $event;
                                        }),
                                        modelModifiers: {
                                            trim: true
                                        },
                                        maxlength: 32,
                                        placeholder: "请输入"
                                    }, null, 8, ["modelValue"])])]), createVNode(_component_SimpleButton, {
                                        class: "flex-none",
                                        type: "primary",
                                        onClick: handleCreatePegging
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[8] || (_cache[8] = [createTextVNode(" 创建 ")]);
                                        }),
                                        _: 1
                                    }), _cache[12] || (_cache[12] = createBaseVNode("hr", {
                                        class: "mx-auto my-4 w-50%"
                                    }, null, -1)), createVNode(_component_SimpleTitle, {
                                        bar: "",
                                        class: "font-600"
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[9] || (_cache[9] = [createTextVNode(" 当前反查绑定数据 ")]);
                                        }),
                                        _: 1
                                    }), unref(peggingList).length === 0 ? (openBlock(), createBlock(_component_Empty, {
                                        key: 0,
                                        class: "h-full"
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[10] || (_cache[10] = [createTextVNode(" 暂无绑定数据 ")]);
                                        }),
                                        _: 1
                                    })) : (openBlock(), createElementBlock("div", _hoisted_10$1, [_cache[11] || (_cache[11] = createBaseVNode("div", {
                                        border: "b base",
                                        class: "h-36px w-full flex flex-nowrap items-center justify-between gap-1 bg-hover px-4 text-sm"
                                    }, [createBaseVNode("span", {
                                        class: "color-base font-600"
                                    }, "COLUMN_NAME"), createBaseVNode("span", {
                                        class: "color-base font-600"
                                    }, "COUNT_ID"), createBaseVNode("span", {
                                        class: "color-base font-600"
                                    }, "DATA_ID")], -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(peggingList), function (item, index) {
                                        return openBlock(), createElementBlock("div", {
                                            key: index,
                                            border: "b base",
                                            class: "h-36px w-full flex flex-nowrap items-center justify-between gap-1 hover:bg-hover px-4 text-sm"
                                        }, [createBaseVNode("code", _hoisted_11$1, toDisplayString(handlePeggingInfo(item).key), 1), createBaseVNode("code", _hoisted_12$1, toDisplayString(handlePeggingInfo(item).countScriptId), 1), createBaseVNode("code", _hoisted_13$1, toDisplayString(handlePeggingInfo(item).dataScriptId), 1)]);
                                    }), 128))]))])])];
                                }),
                                _: 1
                            }, 8, ["modelValue"]);
                        };
                    }
                });
                var _hoisted_1 = {
                    class: "h-full flex flex-col overflow-y-overlay rounded-lg bg-base p4"
                };
                var _hoisted_2 = {
                    class: "relative mx-auto w-50% py-4"
                };
                var _hoisted_3 = {
                    class: "grid grid-cols-[max-content_1fr] items-center gap-2 pb-4"
                };
                var _hoisted_4 = {
                    class: "flex items-center gap-2"
                };
                var _hoisted_5 = {
                    class: "h-8 purple-badge gap-1 border border-purple-200 rounded"
                };
                var _hoisted_6 = {
                    class: "text-0.9rem op70"
                };
                var _hoisted_7 = {
                    class: "mt-4 flex-1"
                };
                var _hoisted_8 = {
                    key: 2,
                    class: "h-full flex-center"
                };
                var _hoisted_9 = {
                    class: "h-full w-700px flex flex-col"
                };
                var _hoisted_10 = {
                    flex: "~ gap2 none items-center justify-between",
                    border: "b base",
                    class: "relative bg-hover px-4 py-1"
                };
                var _hoisted_11 = {
                    class: "font-600"
                };
                var _hoisted_12 = {
                    class: "flex items-center gap-4"
                };
                var _hoisted_13 = {
                    class: "mt-4 flex justify-end gap-4"
                };
                var _sfc_main = exports("default", /* @__PURE__ */defineComponent({
                    __name: "index",
                    setup: function setup(__props) {
                        var appStore = useAppStore();
                        var _storeToRefs = storeToRefs(appStore),
                            modelViewType = _storeToRefs.modelViewType;
                        var models = ref([]);
                        var loading = ref(false);
                        var allTags = ref([]);
                        var conditionalFiltered = computed(function () {
                            var conditional = models.value;
                            if (modelFilters.tags.length) {
                                conditional = conditional.filter(function (model) {
                                    var tags = JSON.parse(model.tags || "[]");
                                    return tags.some(function (tag) {
                                        return modelFilters.tags.includes(tag);
                                    });
                                });
                            }
                            return conditional;
                        });
                        var fuse = computed(function () {
                            return new Fuse(conditionalFiltered.value, {
                                keys: ["modelName", "desciption", "tags", "scope"],
                                threshold: 0.5
                            });
                        });
                        var filtered = ref(conditionalFiltered.value);
                        watchDebounced(function () {
                            return [modelFilters.search, conditionalFiltered.value];
                        }, function () {
                            if (!modelFilters.search) return filtered.value = conditionalFiltered.value;
                            filtered.value = fuse.value.search(modelFilters.search).map(function (i) {
                                return i.item;
                            });
                        }, {
                            debounce: 200
                        });
                        var isDefaultFilters = computed(function () {
                            return !(modelFilters.search || modelFilters.tags.length);
                        });

                        function resetFilters() {
                            modelFilters.search = "";
                            modelFilters.tags = [];
                        }

                        function getModels() {
                            var params = {
                                query: 1,
                                pageSize: 800
                            };
                            loading.value = true;
                            getModelList(params).then(function (res) {
                                models.value = res.data;
                            }).catch(function () {
                                models.value = [];
                            }).finally(function () {
                                loading.value = false;
                            });
                        }

                        function getTags() {
                            getAllTags().then(function (res) {
                                allTags.value = res.data.map(function (i) {
                                    return i.tagName;
                                });
                            }).catch(function () {
                                allTags.value = [];
                            });
                        }

                        onMounted(function () {
                            getModels();
                            getTags();
                        });
                        var selectedModel = ref();
                        var showDetailDrawer = ref(false);

                        function handleDetail(model) {
                            selectedModel.value = Object.assign({}, model);
                            showDetailDrawer.value = true;
                        }

                        var router = useRouter();

                        function handleCreateJob(model) {
                            window.open(router.resolve({
                                name: "JobCreate",
                                query: {
                                    modelIdFromModelPage: model.id
                                }
                            }).href, "_blank");
                        }

                        function handleShowJobs(model) {
                            window.open(router.resolve({
                                name: "JobList",
                                query: {
                                    modelIdFromModelPage: model.id,
                                    modelNameFromModelPage: encodeURIComponent(model.modelName)
                                }
                            }).href, "_blank");
                        }

                        var showPeggingDrawer = ref(false);

                        function handleShowPegging(model) {
                            selectedModel.value = Object.assign({}, model);
                            showPeggingDrawer.value = true;
                        }

                        var showEditDrawer = ref(false);

                        function handleEdit(model) {
                            selectedModel.value = Object.assign({}, model);
                            showEditDrawer.value = true;
                        }

                        var deleteVisible = ref(false);

                        function handleDelete(model) {
                            selectedModel.value = Object.assign({}, model);
                            deleteVisible.value = true;
                        }

                        function confirmDelete() {
                            var _selectedModel$value;
                            deleteModel((_selectedModel$value = selectedModel.value) === null || _selectedModel$value === void 0 ? void 0 : _selectedModel$value.id).then(function () {
                                deleteVisible.value = false;
                            });
                        }

                        function handleSuccess() {
                            getModels();
                            showEditDrawer.value = false;
                        }

                        return function (_ctx, _cache) {
                            var _component_SelectGroup = _sfc_main$d;
                            var _component_ViewType = __unplugin_components_1;
                            var _component_Loading = _sfc_main$e;
                            var _component_Empty = _sfc_main$9;
                            var _component_IconButton = _sfc_main$f;
                            var _component_SimpleDrawer = _sfc_main$6;
                            var _component_SimpleButton = _sfc_main$c;
                            var _component_SimpleDialog = _sfc_main$h;
                            return openBlock(), createElementBlock("div", _hoisted_1, [unref(models) && unref(models).length > 0 ? (openBlock(), createElementBlock(Fragment, {
                                key: 0
                            }, [createBaseVNode("div", _hoisted_2, [withDirectives(createBaseVNode("input", {
                                "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
                                    return unref(modelFilters).search = $event;
                                }),
                                placeholder: "模型搜索...",
                                maxlength: "100",
                                class: "w-full border-2px border-base rounded-xl bg-transparent px3 py2 pl10 outline-none focus:border-primary"
                            }, null, 512), [[vModelText, unref(modelFilters).search]]), _cache[10] || (_cache[10] = createBaseVNode("div", {
                                class: "absolute bottom-0 left-0 top-0 flex-center p4 op50"
                            }, [createBaseVNode("div", {
                                class: "i-ph-magnifying-glass-duotone text-1.1rem"
                            })], -1))]), createBaseVNode("div", _hoisted_3, [_cache[11] || (_cache[11] = createBaseVNode("div", {
                                class: "text-right text-sm font-500 op60"
                            }, " 标签： ", -1)), createVNode(_component_SelectGroup, {
                                modelValue: unref(modelFilters).tags,
                                "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) {
                                    return unref(modelFilters).tags = $event;
                                }),
                                multiple: "",
                                options: unref(allTags),
                                titles: unref(allTags).map(function (i) {
                                    return "#".concat(i);
                                })
                            }, null, 8, ["modelValue", "options", "titles"])]), createBaseVNode("div", _hoisted_4, [createBaseVNode("div", _hoisted_5, [createBaseVNode("span", null, toDisplayString(unref(filtered).length), 1), createBaseVNode("span", _hoisted_6, "/ " + toDisplayString(unref(models).length) + " 模型", 1)]), !unref(isDefaultFilters) ? (openBlock(), createElementBlock("button", {
                                key: 0,
                                class: "h-8 inline-flex orange-badge gap-1 border border-orange-200 text-0.9rem text-op70 hover:text-op100",
                                onClick: _cache[2] || (_cache[2] = function ($event) {
                                    return resetFilters();
                                })
                            }, _cache[12] || (_cache[12] = [createBaseVNode("div", {
                                class: "i-ph:funnel-duotone"
                            }, null, -1), createBaseVNode("span", {
                                class: ""
                            }, "重置", -1), createBaseVNode("div", {
                                class: "i-ph-x cursor-pointer op70"
                            }, null, -1)]))) : (openBlock(), createElementBlock("button", {
                                key: 1,
                                class: "h-8 gray-badge gap-1 border border-gray-200 text-0.9rem text-op70 hover:text-op100",
                                onClick: getModels
                            }, _cache[13] || (_cache[13] = [createBaseVNode("div", {
                                class: "i-mdi:refresh"
                            }, null, -1), createTextVNode(" 刷新 ")]))), createVNode(_component_ViewType, {
                                modelValue: unref(modelViewType),
                                "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
                                    return isRef(modelViewType) ? modelViewType.value = $event : null;
                                }),
                                class: "ml-auto h-8"
                            }, null, 8, ["modelValue"])])], 64)) : createCommentVNode("", true), createBaseVNode("div", _hoisted_7, [unref(loading) ? (openBlock(), createBlock(_component_Loading, {
                                key: 0
                            })) : unref(models) && unref(models).length > 0 ? (openBlock(), createElementBlock("div", {
                                key: 1,
                                class: normalizeClass(["px-0 py-2", unref(modelViewType) === "grid" ? "grid grid-cols-[repeat(auto-fill,minmax(min(100%,300px),1fr))] gap-5 px-0 py-2" : "flex flex-col gap-2"])
                            }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(filtered), function (model, idx) {
                                return openBlock(), createBlock(ModelItem, {
                                    key: idx,
                                    model: model,
                                    "view-type": unref(modelViewType),
                                    onShowDetail: function onShowDetail($event) {
                                        return handleDetail(model);
                                    },
                                    onShowEdit: function onShowEdit($event) {
                                        return handleEdit(model);
                                    },
                                    onDelete: function onDelete($event) {
                                        return handleDelete(model);
                                    },
                                    onShowPegging: function onShowPegging($event) {
                                        return handleShowPegging(model);
                                    },
                                    onShowJobs: function onShowJobs($event) {
                                        return handleShowJobs(model);
                                    },
                                    onCreateJob: function onCreateJob($event) {
                                        return handleCreateJob(model);
                                    }
                                }, null, 8, ["model", "view-type", "onShowDetail", "onShowEdit", "onDelete", "onShowPegging", "onShowJobs", "onCreateJob"]);
                            }), 128))], 2)) : (openBlock(), createElementBlock("div", _hoisted_8, [createVNode(_component_Empty, {
                                icon: "i-carbon:border-none op60 text-1.4rem"
                            }, {
                                default: withCtx(function () {
                                    return _cache[14] || (_cache[14] = [createBaseVNode("span", {
                                        class: "op60"
                                    }, "暂无模型", -1)]);
                                }),
                                _: 1
                            })]))]), unref(showDetailDrawer) ? (openBlock(), createBlock(_sfc_main$4, {
                                key: 1,
                                modelValue: unref(showDetailDrawer),
                                "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) {
                                    return isRef(showDetailDrawer) ? showDetailDrawer.value = $event : null;
                                }),
                                model: unref(selectedModel)
                            }, null, 8, ["modelValue", "model"])) : createCommentVNode("", true), unref(showPeggingDrawer) ? (openBlock(), createBlock(_sfc_main$1, {
                                key: 2,
                                modelValue: unref(showPeggingDrawer),
                                "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) {
                                    return isRef(showPeggingDrawer) ? showPeggingDrawer.value = $event : null;
                                }),
                                model: unref(selectedModel)
                            }, null, 8, ["modelValue", "model"])) : createCommentVNode("", true), createVNode(_component_SimpleDrawer, {
                                modelValue: unref(showEditDrawer),
                                "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) {
                                    return isRef(showEditDrawer) ? showEditDrawer.value = $event : null;
                                })
                            }, {
                                default: withCtx(function () {
                                    var _unref, _unref2;
                                    return [createBaseVNode("div", _hoisted_9, [createBaseVNode("div", _hoisted_10, [createBaseVNode("span", _hoisted_11, "模型【" + toDisplayString((_unref = unref(selectedModel)) === null || _unref === void 0 ? void 0 : _unref.modelName) + " - " + toDisplayString((_unref2 = unref(selectedModel)) === null || _unref2 === void 0 ? void 0 : _unref2.id) + "】编辑", 1), createVNode(_component_IconButton, {
                                        "icon-class": "i-carbon:close text-1.2rem",
                                        onClick: _cache[6] || (_cache[6] = function ($event) {
                                            return showEditDrawer.value = false;
                                        })
                                    })]), createVNode(_sfc_main$g, {
                                        model: unref(selectedModel),
                                        type: "UPDATE",
                                        class: "flex-1 overflow-y-auto p-6 pb-10",
                                        onSuccess: handleSuccess
                                    }, null, 8, ["model"])])];
                                }),
                                _: 1
                            }, 8, ["modelValue"]), createVNode(_component_SimpleDialog, {
                                modelValue: unref(deleteVisible),
                                "onUpdate:modelValue": _cache[9] || (_cache[9] = function ($event) {
                                    return isRef(deleteVisible) ? deleteVisible.value = $event : null;
                                }),
                                class: "flex flex-col gap-4 p-6 !w-400px"
                            }, {
                                default: withCtx(function () {
                                    var _unref3;
                                    return [createBaseVNode("h2", _hoisted_12, [_cache[15] || (_cache[15] = createBaseVNode("i", {
                                        class: "i-ph:warning-duotone flex-none text-2rem text-orange"
                                    }, null, -1)), createTextVNode(" 确认删除模型【" + toDisplayString((_unref3 = unref(selectedModel)) === null || _unref3 === void 0 ? void 0 : _unref3.modelName) + "】吗？ ", 1)]), createBaseVNode("div", _hoisted_13, [createVNode(_component_SimpleButton, {
                                        onClick: _cache[8] || (_cache[8] = function ($event) {
                                            return deleteVisible.value = false;
                                        })
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[16] || (_cache[16] = [createTextVNode(" 取消 ")]);
                                        }),
                                        _: 1
                                    }), createVNode(_component_SimpleButton, {
                                        type: "primary",
                                        onClick: confirmDelete
                                    }, {
                                        default: withCtx(function () {
                                            return _cache[17] || (_cache[17] = [createTextVNode(" 确定 ")]);
                                        }),
                                        _: 1
                                    })])];
                                }),
                                _: 1
                            }, 8, ["modelValue"])]);
                        };
                    }
                }));
            }
        };
    });
})();
